Webpack error handling


What is the best way to handle runtime errors?
Specifically using the svelte framework.

I have noticed that if an error occurs the app would become unresponsive.
I have been tracking them with the window.error event, but Im not sure on what would be the best way to “catch” the error and prevent the unresponsiveness.

Depends on kind of errors, but best way, especially with async/await errors is using try/catch statements

Mainly within the component (markup) code.
I can put try/catch inside my script functions, but if there is an error inside the component code for instance inside a foreach the app would throw an error and then become unresponsive.

I’d like to know what the best way to catch and handle these errors.