Skip to content

Commit 3738449

Browse files
committed
Continue reporting exceptions when window.onerror returns false
FIX: Make `logException` log errors to the console when `onerror` returns a falsy value. See https://discuss.codemirror.net/t/logexception-does-not-check-return-value-of-window-onerror/9193
1 parent 23400c5 commit 3738449

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const setEditContextFormatting = StateEffect.define<DecorationSet>()
9191
export function logException(state: EditorState, exception: any, context?: string) {
9292
let handler = state.facet(exceptionSink)
9393
if (handler.length) handler[0](exception)
94-
else if (window.onerror) window.onerror(String(exception), context, undefined, undefined, exception)
94+
else if (window.onerror && window.onerror(String(exception), context, undefined, undefined, exception)) {}
9595
else if (context) console.error(context + ":", exception)
9696
else console.error(exception)
9797
}

0 commit comments

Comments
 (0)