Skip to Main Content
Eloquent JavaScript
book

Eloquent JavaScript

by Marijn Haverbeke
January 2011
Intermediate to advanced content levelIntermediate to advanced
224 pages
5h 43m
English
No Starch Press
Content preview from Eloquent JavaScript

Chapter 4. Error Handling

In most of the example programs so far, I either noted that they expected their input to be valid or ignored the possibility of problematic input altogether. There are situations in which we can get away with this, such as when a program is only for our own use or when we can be positively certain that there will be no unexpected input. In serious programs, however, some kind of disaster plan is usually needed.

Types of Problems

The problematic situations that a program can encounter can roughly be divided into two categories: programmer mistakes and run-time problems. If someone forgets to pass a required argument to a function, that is a programmer mistake. On the other hand, if a program asks the user to enter a name ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Eloquent JavaScript, 3rd Edition

Eloquent JavaScript, 3rd Edition

Marijn Haverbeke
Learn JavaScript

Learn JavaScript

Shaun Wassell

Publisher Resources

ISBN: 9781593272821Errata