From 4e5381f8ee4bbbff738cf1141130742da2d6b4ae Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 8 Mar 2024 10:47:32 +0100 Subject: [PATCH] Don't show AbortErrors on logout (#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 886e90aa82521d2c2ae17d3e177c056ae32e4aa6) --- 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 211253ef9a..ee4ade1f04 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -105,8 +105,10 @@ async function fetchActionDoRequest(actionElem, url, opt) { showErrorToast(`server error: ${resp.status}`); } } catch (e) { - console.error('error when doRequest', e); - showErrorToast(`${i18n.network_error} ${e}`); + if (e.name !== 'AbortError') { + console.error('error when doRequest', e); + showErrorToast(`${i18n.network_error} ${e}`); + } } actionElem.classList.remove('is-loading', 'small-loading-icon'); }