fix: a file the phone cannot read tells the customer to save it on the phone first, and Sentry learns its kind (DTF-WEB-2D)
All checks were successful
Build and deploy / Validate source (push) Successful in 8s
Build and deploy / Integration suite on a real stack (push) Successful in 8m14s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m22s

The same Android 10 phone failed three times on 2026-12-02 reading a file
seven seconds after picking it: not a permission lost over time, but a file
the phone does not have yet (Google Drive or WhatsApp). "Escolha o arquivo de
novo" sent the customer back to the same file. The message now says "Se ele
está no Google Drive ou no WhatsApp, salve no aparelho e escolha de novo".
The Sentry notice carries the browser's error name, the file's type,
extension and size in MB, never its name, so the next one says which case
it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-02 14:23:11 -03:00
parent 1633b995eb
commit fe5e9c4f4a
5 changed files with 20 additions and 5 deletions

View File

@@ -284,7 +284,7 @@
if(window.dtfContaAberta&&typeof pintaPedido==='function')pintaPedido();},
error=>{envios.delete(k);if(error?.name!=='AbortError'){falhas.set(k,{file,error});
// A refusal with a status already went to Sentry as an API error (DTF-WEB-15).
if(!error?.status)window.dtfObservability?.uiError?.('Envio de arquivo falhou: '+(error?.message||'erro no envio'),'site');}pintaEnvio();});
if(!error?.status)window.dtfObservability?.uiError?.('Envio de arquivo falhou: '+(error?.message||'erro no envio'),'site',error?.detalhe);}pintaEnvio();});
envios.set(k,e);
}
return e.promise;

View File

@@ -149,14 +149,14 @@
// Every error the page shows the user in red, also the ones it caught and
// handled itself (a folder it could not write, an upload that failed): the
// team sees them in Sentry before anyone sends a screenshot.
function uiError(text, where) {
function uiError(text, where, detail) {
if (!started || !text || typeof Sentry === 'undefined') return;
const said = recent.get(String(text));
if (said && Date.now() - said < 15000) return;
try {
const kind = normalizedMessage(text);
Sentry.captureMessage('Aviso ' + (where || app) + ': ' + kind,
{level: 'error', tags: {app, aviso: where || app}, extra: {page: location.pathname},
{level: 'error', tags: {app, aviso: where || app}, extra: {page: location.pathname, ...(detail || {})},
fingerprint: ['ui-error', where || app, kind]});
} catch (error) {
// Reporting an error must never break the page.

View File

@@ -23,8 +23,13 @@ async function sendUpload(file, {api, prefix='/uploads', startPath=prefix, progr
try{ sampled=await samples.arrayBuffer(); }
catch(error){
if(error?.name!=='NotReadableError' && error?.name!=='NotFoundError') throw error;
const unreadable=new Error('não conseguimos ler este arquivo no aparelho. Escolha o arquivo de novo');
// A file in Google Drive or WhatsApp that is not on the phone yet fails the
// same way, at once (DTF-WEB-2D): the message says how to get out of it.
const unreadable=new Error('não conseguimos ler este arquivo no aparelho. Se ele está no Google Drive ou no WhatsApp, salve no aparelho e escolha de novo');
unreadable.unreadable=true;
// For Sentry: what kind of file the phone refused, never its name.
const ext=/\.([a-z0-9]{1,5})$/i.exec(file.name||'')?.[1]?.toLowerCase()||'';
unreadable.detalhe={erro:error.name,tipo:file.type||'',extensao:ext,mb:Math.round((file.size||0)/1048576*10)/10};
throw unreadable;
}
const hash=Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256',sampled)),b=>b.toString(16).padStart(2,'0')).join('');