fix: a refusal the server explains is a warning on the Kanban and is not sent from the Site
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 8m58s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m26s

Of about 60 Sentry issues in two weeks, five were bugs: the rest were the
system working (a rule, a check, a limit explained to the person) or a
network drop. A 4xx with a sentence for the person is now a warning on the
Kanban, tagged recusa, still counted per kind, since a refusal the team keeps
meeting says a screen confuses; the Site sends none, the customer reads it.
A 4xx with a list of fields (what the page sent was wrong) and a 5xx stay
errors, as do JavaScript errors and the red messages that do not come from a
refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-30 10:02:15 -03:00
parent 9fc4d4e906
commit eb7a92bb89
2 changed files with 32 additions and 1 deletions

View File

@@ -122,6 +122,14 @@
if (!started || status === 401 || typeof Sentry === 'undefined') return;
// A restart's few seconds without the database (app/app.py): not a bug.
if (status === 503 && /reiniciando/.test(String(message))) return;
// A refusal the server explains to the person (a rule, a check, a limit:
// a 4xx with a sentence for them) is the system working, not a bug: on
// the Kanban it stays, as a warning, since a refusal the team keeps
// meeting says a screen confuses; on the Site the customer reads it and
// nothing is sent (2026-11-30). A 4xx without a sentence (a list of
// fields: what the page sent was wrong) and a 5xx stay errors.
const refusal = status >= 400 && status < 500 && typeof detail === 'string';
if (refusal && app !== 'kanban') return;
try {
// One issue per kind of API error: without this Sentry groups them all
// by apiError and DTF-WEB-1 mixes a 422 for 66 files with a 422 for
@@ -131,7 +139,7 @@
const extra = {path, status, page: location.pathname};
if (status === 422 && detail) extra.detail = detail;
Sentry.captureMessage('API ' + status + ' ' + kindPath + ': ' + kindMessage,
{level: 'error', tags: {app}, extra,
{level: refusal ? 'warning' : 'error', tags: {app, ...(refusal ? {recusa: 'sim'} : {})}, extra,
fingerprint: ['api-error', String(status), kindPath, kindMessage]});
} catch (error) {
// Reporting an error must never break the page.