SuppressedError: error
The error data property of a SuppressedError instance contains a reference to the error that results in the suppression.
The error data property of a SuppressedError instance contains a reference to the error that results in the suppression.
Value
Any value. Like cause, you cannot assume it's an Error instance, although it usually is the case.
0
Examples
Using error
try {
throw new SuppressedError(
new Error("New error"),
new Error("Original error"),
"Hello",
);
} catch (e) {
console.log(e.error); // Error: "New error"
}
Specifications
Browser compatibility
See also
- Polyfill of
SuppressedErrorincore-js - Control flow and error handling guide
- SuppressedError
Error:cause