Error cause
Modules
es.aggregate-error.cause and es.error.cause.
Built-ins signatures
class Error {
constructor(message?: string, { cause: any }?): %Error%;
}
class [
EvalError,
RangeError,
ReferenceError,
SyntaxError,
TypeError,
URIError,
WebAssembly.CompileError,
WebAssembly.LinkError,
WebAssembly.RuntimeError,
] extends Error {
constructor(message?: string, { cause: any }?): %Error%;
}
class AggregateError extends Error {
constructor(errors: Iterable, message?: string, { cause: any }?): AggregateError;
cause: any;
}
Entry points
core-js/proposals/error-cause
core-js/es|stable|actual|full/error
core-js/es|stable|actual|full/error/constructor
core-js(-pure)/es|stable|actual|full/aggregate-error
Examples
const cause = new TypeError('Something wrong');
const error = new TypeError('Here is what went wrong', { cause });
error.cause === cause; // => true