Creates an error with the provided message.
Error message; defaults to an empty string.
The new error instance.
OptionalcauseReadonlymessageOptionalstackStaticfromCreates an instance from an optional message string.
Optionalmessage: string
Error message; defaults to an empty string.
A new BaseError instance.
StaticimprintRepairs an error instance's name, stack trace, and prototype chain.
Error instance to repair.
StaticisIndicates whether the argument provided is a built-in Error instance or not.
Base class for custom errors with repaired subclass prototypes and names.
Call
imprintin subclass constructors on runtimes where extending nativeErrordoes not preserve the expected prototype chain.Example