Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-21 17:34:24 +01:00

[GITEA] Limit amount of javascript errors being shown

- Currently an unlimited amount of errors could be shown to the user,
this can cause that if something goes wrong the user will be shown a big
wall of errors, even when Forgejo in most cases can still be used.
- Therefor limit to three errors being shown, as it's unlikely that
three seperate javascript errors needs to be shown, they are likely to
be related and the console still shows all of the errors.
This commit is contained in:
Gusted 2024-01-18 18:33:40 +01:00
parent fed50cf72e
commit 424a745c4a
No known key found for this signature in database
GPG key ID: FD821B732837125F

View file

@ -8,6 +8,8 @@ __webpack_public_path__ = `${window.config?.assetUrlPrefix ?? '/assets'}/`;
export function showGlobalErrorMessage(msg) {
const pageContent = document.querySelector('.page-content');
if (!pageContent) return;
// Prevent a wall of errors being presented to the user.
if (document.querySelectorAll('.js-global-error').length >= 3) return;
const el = document.createElement('div');
el.innerHTML = `<div class="ui container negative message center aligned js-global-error" style="white-space: pre-line;"></div>`;
el.childNodes[0].textContent = msg;