Skip to content

Glossary: JavaScript Beyond the Basics

Error classes (custom)

Also written: custom error, custom errors, Error, TypeError, RangeError, SyntaxError, ReferenceError

An ordinary class that extends `Error`, with `name` set so logs show the right type, plus extra properties a caller can use, like `available` on `OutOfStockError`. The built-in types cover wrong type, out-of-range numbers, unreadable code or JSON, and unknown names.

Where the book teaches it

Related terms

instanceofRe-throwcause