I understand what causes runtime errors. I want to understand how the browser behaves afterwards.
Will event handlers attached before the error still work?
If a script loaded async finishes after a runtime error will it be able to execute?
Basically, how catastrophic is a run-time error?
An uncaught runtime error only stops the current execution, which may be
Suppose you have a runtime error while handling an event, the only problem you might have (apart not really handling the event) is a non consistent state of your user variables if your event handler modifies some of them. Other event handlers won't be impacted besides that.
So it can usually be considered as non catastrophic (I guess I don't have to remember it's a good practice to fix errors anyways and that flooding the console with errors isn't a good thing).
You can use the try/catch/finally block. Using the catch block you can navigate inside the error and it will be running when a run-time error occurred or an illegal operation occurs. Visit this link, here is some more information about try/catch/finally http://www.javascriptkit.com/javatutors/trycatch.shtml
A run-time error can be catastrophic depends on where it happened and what does the piece of code when it occurs. In this way you can crash all the application or just stop some plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With