diff options
author | yp05327 <576951401@qq.com> | 2023-08-22 11:30:02 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-22 10:30:02 +0800 |
commit | a4a567f29f69e39d57a9fa7008d708f7fd080e58 (patch) | |
tree | a33773d1860087d7ec4c766c2117e405b03be335 /web_src/js/bootstrap.js | |
parent | b3f713717407fcb66515a7a702e81b2028800f76 (diff) | |
download | gitea-a4a567f29f69e39d57a9fa7008d708f7fd080e58.tar.gz gitea-a4a567f29f69e39d57a9fa7008d708f7fd080e58.zip |
Check disabled workflow when rerun jobs (#26535)
In GitHub, we can not rerun jobs if the workflow is disabled.
---------
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'web_src/js/bootstrap.js')
-rw-r--r-- | web_src/js/bootstrap.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/web_src/js/bootstrap.js b/web_src/js/bootstrap.js index f0b020ce1c..43075ab241 100644 --- a/web_src/js/bootstrap.js +++ b/web_src/js/bootstrap.js @@ -20,6 +20,10 @@ export function showGlobalErrorMessage(msg) { * @param {ErrorEvent} e */ function processWindowErrorEvent(e) { + if (e.type === 'unhandledrejection') { + showGlobalErrorMessage(`JavaScript promise rejection: ${e.reason}. Open browser console to see more details.`); + return; + } if (!e.error && e.lineno === 0 && e.colno === 0 && e.filename === '' && window.navigator.userAgent.includes('FxiOS/')) { // At the moment, Firefox (iOS) (10x) has an engine bug. See https://github.com/go-gitea/gitea/issues/20240 // If a script inserts a newly created (and content changed) element into DOM, there will be a nonsense error event reporting: Script error: line 0, col 0. @@ -30,6 +34,10 @@ function processWindowErrorEvent(e) { } function initGlobalErrorHandler() { + if (window._globalHandlerErrors?._inited) { + showGlobalErrorMessage(`The global error handler has been initialized, do not initialize it again`); + return; + } if (!window.config) { showGlobalErrorMessage(`Gitea JavaScript code couldn't run correctly, please check your custom templates`); } @@ -40,7 +48,7 @@ function initGlobalErrorHandler() { processWindowErrorEvent(e); } // then, change _globalHandlerErrors to an object with push method, to process further error events directly - window._globalHandlerErrors = {'push': (e) => processWindowErrorEvent(e)}; + window._globalHandlerErrors = {_inited: true, push: (e) => processWindowErrorEvent(e)}; } initGlobalErrorHandler(); |