The type of the cause of the error, which can be any object or error.
Creates a new instance of the BasaltError class.
OptionalbasaltErrorOptions: Readonly<BasaltErrorOptions<T>>The options for the Basalt error. (BasaltErrorOptions)
ReadonlycauseThe cause of the error, typically used to store the original error or additional context.
OptionalstackStatic OptionalprepareOptional override for formatting stack traces
StaticstackThe maximum number of stack frames to capture.
Gets the date when the error was created.
The creation date of the error.
Gets the HTTP status code associated with the error.
The HTTP status code.
Gets the error key, which identifies the type of error.
The key associated with the error.
Gets the unique identifier of the error.
The UUID of the error.
StaticcaptureCreate .stack property on a target object
OptionalconstructorOpt: FunctionCreate .stack property on a target object
OptionalconstructorOpt: FunctionStaticisCheck if a value is an instance of Error
The value to check
True if the value is an instance of Error, false otherwise
A custom error class that extends the native Error class, providing additional properties such as a unique identifier, error key, HTTP status code, and cause.
Example
The following example demonstrates how to throw and catch a BasaltError.
Example
The following example demonstrates how to create a BasaltError with a custom cause type.