SuppressedError: error - JavaScript | MDN

Value

Any value. Like cause, you cannot assume it's an Error instance, although it usually is the case.

Property attributes of SuppressedError: error
Writableyes
Enumerableno
Configurableyes

Examples

Using error

js

try {
  throw new SuppressedError(
    new Error("New error"),
    new Error("Original error"),
    "Hello",
  );
} catch (e) {
  console.log(e.error); // Error: "New error"
}

Specifications

Specification
ECMAScript Async Explicit Resource Management
# sec-suppressederror

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.