Skip to content

Commit

Permalink
Don't show AbortErrors on logout (#29639) (#29667)
Browse files Browse the repository at this point in the history
Backport #29639.

When logging out of Gitea, a error toast can be seen for a split second.
I don't know why or how it happens but I found it it's an `AbortError`
(related to
[AbortController#abort](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort)),
so let's hide it.
  • Loading branch information
silverwind committed Mar 9, 2024
1 parent 25b0c99 commit 346b662
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web_src/js/features/common-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ async function fetchActionDoRequest(actionElem, url, opt) {
showErrorToast(`server error: ${resp.status}`);
}
} catch (e) {
console.error('error when doRequest', e);
actionElem.classList.remove('is-loading', 'small-loading-icon');
showErrorToast(i18n.network_error);
if (e.name !== 'AbortError') {
console.error('error when doRequest', e);
showErrorToast(i18n.network_error);
}
}
}

Expand Down

0 comments on commit 346b662

Please sign in to comment.