ReadonlycallerOptional ReadonlycauseReadonlyfieldsReadonlystatusCheck if this error or any error in the cause chain is an instance of the given class.
The error class to check against
true if this error or any wrapped error is an instance of ErrorClass
Get the root cause (the innermost wrapped value)
Serialize error to JSON
When cause is a TracedError, it calls toJSON() recursively to avoid double printing stack traces.
Static[hasCustom instanceof behavior - also matches wrapped errors in the cause chain.
This allows:
const wrapped = TracedError.wrap(new TypeError("bad"), "context");
wrapped instanceof TracedError // true
And when checking the cause chain with is():
wrapped.is(TypeError) // true
StaticfailCreate a new error
Error message
Optionaloptions: TracedErrorOptionsOptional status, fields, and caller info
StaticwrapWrap an existing error with additional context
The cause to wrap (can be any value)
New message describing the context
Optionaloptions: TracedErrorOptionsOptional status, fields, and caller info
Custom error class with tracing support and HTTP status codes.
Features:
Example
Example