Custom Error

noun

say it: “KUS-tum AIR-er” /ˈkʌstəm ˈɛrər/

Your own error class, made with extends Error, for a problem your program knows about, such as ServingsError.

What is Custom Error in JavaScript?

Custom Error — An application-specific error class extending JavaScript's Error class.

class InvalidOrderError extends Error {
}

In a sentence

  • “I made a custom error, ServingsError, so the catch block can tell a bad serving size apart from a bug.”

Level: Journeyman · More JavaScript terms at this level

Updated