Is there an alternative to window.onerror() since the plugin's iFrame doesn't trigger that event?

I would like to properly crash my plugin and prevent any more interactions when an unhandled exception happens, but onerror() is not available. I know wrapping everything in try/catch is an option, but in my case that’s a loooot of work. Is there another automatic way to be notified of errors?

window.onerror is available. Did you declare it in ui.html?

I’m not sure what you mean by “declare”. I tried adding to window an event listener for ‘error’, but the event never arrives.

onerror = (event) => console.error(event);