From 833d7a3b59c4a3000a2db1a96e77df8ab48d00d7 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 14 May 2020 15:52:43 +0200 Subject: [PATCH] javascript: ignore most common upload errors also in standard uploads In #5149, we ignored most common upload errors, but only for auto-uploads. This PR ignores those errors also for standard uploads. --- app/javascript/shared/activestorage/ujs.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/javascript/shared/activestorage/ujs.js b/app/javascript/shared/activestorage/ujs.js index a3459bbb9..0f2822578 100644 --- a/app/javascript/shared/activestorage/ujs.js +++ b/app/javascript/shared/activestorage/ujs.js @@ -1,7 +1,8 @@ import ProgressBar from './progress-bar'; import { errorFromDirectUploadMessage, - FAILURE_CONNECTIVITY + ERROR_CODE_READ, + FAILURE_CLIENT } from './file-upload-error'; import { fire } from '@utils'; @@ -58,8 +59,10 @@ addUploadEventListener(ERROR_EVENT, (event) => { ProgressBar.error(id, errorMsg); + // Report unexpected client errors to Sentry. + // (But ignore usual client errors, or errors we can monitor better on the server side.) let error = errorFromDirectUploadMessage(errorMsg); - if (error.failureReason != FAILURE_CONNECTIVITY) { + if (error.failureReason == FAILURE_CLIENT && error.code != ERROR_CODE_READ) { fire(document, 'sentry:capture-exception', error); } });