O'Reilly logo

Modern JavaScript: Develop and Design by Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12. Error Management

One of the most profound differences between the beginning programmer and the expert is error management. Certainly errors will occur regardless of the skill level of the programmer, as the user causes many problems. But the more seasoned developer does a markedly better job of handling errors when they do occur. In this chapter, you’ll learn three ways to prevent and deal with errors. The first is called exception handling, and takes advantage of JavaScript’s built-in syntax: try...catch. The second approach is the use of assertions, which is an easy debugging tool utilized while writing code. Building on that concept, the chapter concludes with an introduction to unit testing.

Catching and Throwing Errors

Most of the examples ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required