SuppressedError: suppressed
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The suppressed data property of a SuppressedError instance contains a reference to the original error that got suppressed because a new error was generated while handling it.
Value
Any value. Like cause, you cannot assume it's an Error instance, although it usually is the case.
Property attributes of SuppressedError: suppressed | |
|---|---|
| Writable | yes |
| Enumerable | no |
| Configurable | yes |
Examples
>Using suppressed
js
try {
throw new SuppressedError(
new Error("New error"),
new Error("Original error"),
"Hello",
);
} catch (e) {
console.log(e.suppressed); // Error: "Original error"
}
Specifications
| Specification |
|---|
| ECMAScript Async Explicit Resource Management> # sec-suppressederror> |
Browser compatibility
Loading…