Errorsclass

new Errors(errors: Iterable<unknown>, message?: string, options: BaseErrorOptions = {})
ParamType
errorsIterable<unknown>
Iterable of the individual errors being aggregated. required
messagestring
Optional human-readable message describing the aggregate failure.
optionsBaseErrorOptions
Options for BaseError that provide additional helpful error functionality. Defaults to {}
    .callerAnyCaller
Modify the stack to trim off lines after a certain calling function.
Return
Errors
Aggregate an array of errors into a single combined error.

Aggregate an array of errors into a single combined error.

  • Extends (and shadows) the built-in AggregateError but with additional allowed options like caller.

Examples

throw new Errors([new ValueError("Bad name"), new ValueError("Bad age")], "Validation failed");