SuppressedError: suppressed
En esta página
The suppressed data property of a {{jsxref("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 {{jsxref("Error/cause", "cause")}}, you cannot assume it's an {{jsxref("Error")}} instance, although it usually is the case.
{{js_property_attributes(1, 0, 1)}}
Examples#
Using suppressed#
try {
throw new SuppressedError(
new Error("New error"),
new Error("Original error"),
"Hello",
);
} catch (e) {
console.log(e.suppressed); // Error: "Original error"
}
Specifications#
{{Specifications}}
Browser compatibility#
{{Compat}}
See also#
- Control flow and error handling guide
- {{jsxref("SuppressedError")}}
Error:cause