Chapter 16. JavaScript Error Handling
After reading this chapter, you'll be able to
Understand error handling using JavaScript methods.
Handle errors using try/catch statements.
Use try/catch/finally statements.
Handle the onerror event for window and image objects.
An Overview of Error Handling
This chapter looks at two primary, built-in ways of handling error conditions in JavaScript. The try/catch statement pair is available in JavaScript. Many languages, such as Microsoft Visual Basic .NET, include this pair of keywords that help the programmer handle error conditions within their code.
Along with try/catch, JavaScript offers the onerror event, which gives the programmer another tool to perform an action when encountering an error.
Using try/catch ...
Get JavaScript Step by Step now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.