Programmatically handle CodeMirror 6 crashes

We’re hitting some hard-to-reproduce errors with mixedParse and the julia parser (https://github.com/fonsp/Pluto.jl/issues/1913) - is there a way to capture the fact that codemirror crashed and re-run our editors as if they run for the first time (e.g. a “On Crash” plugin? a try-catch block somewhere? polling on the state plugin?) ? That would be helpful to mitigate the user experience until we fix this correctly. Our codemirror setup lives here

Thank you!
Panagiotis

Not really. There’s exceptionSink for plugin errors, but the library itself doesn’t put a try around every event and entry point.

Thanks for your reply!
Quick question: will that capture parsedMixed errors? is there a way to capture these errors (e.g. window.onerror?)

They should land in window.onerror, like all uncaught exceptions. Give it a try.

The errors that end up in window.onerror wouldn’t crash the editor then, right?

1 Like

Depends on what you mean by ‘crash the editor’. Parser errors will probably make it impossible to update the editor state, making the editor entirely unusable.