I\'m looking to start making my JavaScript a bit more error proof, and I\'m finding plenty of documentation on using try
, catch
, finally
,
IHMO, you should use error handling in javascript like you do in several other languages (AFAIK: Python, Java).
For better readability (and probably better performance, even though I am not sure it has a really big impact), you should use the try / catch block mostly on the following cases :
The part of the code you want to wrap is a key part of the whole algorithm. If it fails, it could :
You know that the code you are writing is not compatible with every browser
Eventually, javascript experts may have other elements to give.
my 2 cents to the box,
Regards,
Max