1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00

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)
This commit is contained in:
silverwind 2024-03-08 10:47:32 +01:00 committed by Earl Warren
parent faac0a7c32
commit 4e5381f8ee
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -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');
}