Exception Handling

Exception handling is an important aspect of JavaScript coding. I know that when I first learned exception handling, it opened for me new horizons on how I could approach problems. If an exception occurred because of circumstances that were not ideal, I could react to that exception and still keep my programming running.

The main mechanism for exception handling in JavaScript is the try catch statement. It is great for exception handling, but it is also possible to use try catch in situations where there is not an exception.

I just completed two tutorials on exception handling. The first shows how to use try catch statements in your code. The second talks about when you should and should not use try catch.

Take a look at both videos and if you have any additional rules to add for using try catch statements post them here.

Author: Steven Hancock

Steven has 20+ years experience in product development and 15+ years using JavaScript. He started learning JavaScript when it was a niche language used for minor affects on a web site. The growth and ubiquitous nature of JavaScript both excites and inspires him.

Currently he is President and lead Trainer at All Things JavaScript, a resource for anyone and everyone that hopes to increase their JavaScript skills.

Steven was the co-owner of Rapid Intake, an eLearning Authoring firm. While there he managed all development and professional service related activities. He was heavily involved in the initial development of Rapid Intake’s main product, which eventual lead to its acquisition in 2011. In addition to JavaScript, Steve has also dabbled in other web technolgies such as ActionScript, ASP, PHP, HTML, and CSS.