fix: one Sentry issue per kind of API error; the expected 410 of a resumed upload is silent (Sentry 12/11)

Every failed API call landed in one issue titled Object.apiError; each now
has its own fingerprint and title from status, path and message, with ids
and file names normalized. The 410 of a recovered cart's expired upload
was already handled (the file goes up again from the stored copy); the
probe no longer reports it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-12 10:09:20 -03:00
parent d3918e83dc
commit 6896e6a161
5 changed files with 79 additions and 8 deletions

View File

@@ -37,7 +37,7 @@
localStorage.removeItem(key);
}
function clearDraft() { forgetDraft(); actions.replaceChildren(); }
const api = async (path, body) => {
const api = async (path, body, options = {}) => {
const response = await fetch('/api'+path, {
credentials: 'same-origin', headers: {'Content-Type':'application/json'},
...(body === undefined ? {} : {method:'POST', body:JSON.stringify(body)})
@@ -55,7 +55,10 @@
const error=new Error(text);error.status=response.status;
const retry=response.headers.get('Retry-After');
if(retry!=null)error.retryAfter=retry;
window.dtfObservability?.apiError?.(path,response.status,error.message,data.detail);
// A status the caller expects (a resumed upload that expired) is handled
// there, not reported.
if(!(options.expected||[]).includes(response.status))
window.dtfObservability?.apiError?.(path,response.status,error.message,data.detail);
throw error;
}
return data;