From d55c9ccc1fdd39d76ba35dc03e4e8502a4f2f957 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 21 Apr 2026 19:34:39 -0400 Subject: [PATCH] fix: Reduce noise from XHR upload network errors (#12132) Network-level upload failures (xhr.status === 0) now log as warnings with extra context instead of unhelpful "Error: 0" reports in Sentry. --- app/utils/files.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/utils/files.ts b/app/utils/files.ts index 3299613ca1..5ad4376dd6 100644 --- a/app/utils/files.ts +++ b/app/utils/files.ts @@ -85,9 +85,24 @@ export const uploadFile = async ( } }); xhr.addEventListener("error", () => { + const extra = { + status: xhr.status, + statusText: xhr.statusText, + contentType: file.type, + size: file.size, + }; + + // Status 0 means the request never reached the server (network drop, + // CORS, abort) — log as a warning rather than an unhelpful "Error: 0". + if (xhr.status === 0) { + Logger.warn("File upload failed before response", extra); + return; + } + Logger.error( "File upload failed", - new Error(`${xhr.status} ${xhr.statusText}`) + new Error(`${xhr.status} ${xhr.statusText}`), + extra ); }); xhr.addEventListener("loadend", () => {