From 4f9b761a0681211ae6dae38b95448798256031b1 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 9 Mar 2024 10:22:18 +0100 Subject: [PATCH] Don't show AbortErrors on logout (#29639) (#29667) Backport https://github.com/go-gitea/gitea/pull/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. (cherry picked from commit 346b66230519955fc831e75a9cc6175621d63b02) --- web_src/js/features/common-global.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index d68f13043b..e552908572 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -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); + } } }