Often when working with CodeMirror 6, there is clearly some error, but nothing gets logged in the console. I just see a broken CodeMirror.
I believe this is an issue with logException. Under normal browser conditions, I think window.onerror()
will also log to the console. It seems however that logException()
ignores the return value, and thus nothing gets logged.
Something like this might fix it (using transpiled code here):
function logException(state, exception, context) {
let handler = state.facet(exceptionSink);
if (handler.length)
handler[0](exception);
else if (window.onerror)
- window.onerror(String(exception), context, undefined, undefined, exception);
+ const ret = window.onerror(String(exception), context, undefined, undefined, exception);
+ if (!ret) {
+ console.error(context + ":", exception);
+ }
else if (context)
console.error(context + ":", exception);
else
console.error(exception);
}
Is this in fact a bug, or are we instead expected to use exceptionSink?
Thanks as always <3