Skip to main content
Alex_FG
New Participant
Feb 22, 2023 8:54 PM UTC
Question

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?

This topic has been closed for replies.

3 replies

tank666
Feb 22, 2023 9:14 PM UTC

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

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Alex_FG
Alex_FGAuthor
New Participant
Feb 22, 2023 9:19 PM UTC

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

tank666
Feb 22, 2023 9:46 PM UTC
onerror = (event) => console.error(event);
nonExistentVariable;
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank