js: don't report autosave failures that are timeouts

This prevents spamming Sentry with "[Autosave] Error: 0" messages.
This commit is contained in:
Pierre de La Morinerie 2021-09-07 16:45:16 -05:00
parent 8dce7d59ed
commit ad8dcc7f7d

View file

@ -73,7 +73,11 @@ addEventListener('autosave:error', (event) => {
enable(document.querySelector('button.autosave-retry')); enable(document.querySelector('button.autosave-retry'));
setState('failed'); setState('failed');
logError(event.detail);
const shouldLogError = !error.xhr || error.xhr.status != 0; // ignore timeout errors
if (shouldLogError) {
logError(error);
}
}); });
function setState(state) { function setState(state) {