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.