There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(core): handle global script error (#8576)
forehaloff95f12d66a1
diff --git a/tools/cli/src/webpack/error-handler.js b/tools/cli/src/webpack/error-handler.jsindex 2acd7a46d1..c1635eb79e 100644--- a/tools/cli/src/webpack/error-handler.js+++ b/tools/cli/src/webpack/error-handler.js@@ -33,23 +33,37 @@document.body.append(errorEl);}- function registerGlobalErrorHandler() {- function handler(e) {- var error =- 'error' in e ? e.error : e.reason instanceof Error ? e.reason : null;- console.error('unhandled unrecoverable error', error);+ /**+ * @param event {PromiseRejectionEvent|ErrorEvent}+ */+ function handler(event) {+ var error;- const shouldCache =- // syntax error- error && error instanceof SyntaxError;+ if ('error' in event) {+ error =+ event.error ||+ (event.message === 'Script error.'+ ? new SyntaxError(event.message)+ : new Error(event.message));+ } else {+ error = event.reason;+ }- if (!shouldCache) {- return;- }+ console.error('unhandled unrecoverable error', error);++ var shouldCache =+ // syntax error+ error && error instanceof SyntaxError;- e.stopImmediatePropagation();- showGlobalErrorPage();+ if (!shouldCache) {+ return;}++ event.stopImmediatePropagation();+ showGlobalErrorPage();+ }++ function registerGlobalErrorHandler() {if (typeof document !== 'undefined') {globalThis.addEventListener('unhandledrejection', handler);globalThis.addEventListener('error', handler);