es-aggregate-error
ES Proposal spec-compliant shim for AggregateError. Invoke its "shim" method to shim AggregateError
if it is unavailable or noncompliant.
This package implements the es-shim API interface. It works in an ES3-supported environment, and complies with the proposed spec.
Most common usage:
var assert = require('assert');
var AggregateError = require('es-aggregate-error');
var oneError = new RangeError('hi!');
var otherError = new EvalError('oops');
var error = new AggregateError([oneError, otherError], 'this is two kinds of errors');
assert.deepEqual(error.errors, [oneError, otherError]);
assert.equal(error.message, 'this is two kinds of errors');
AggregateError.shim();
assert.ok(new globalThis.AggregateError([]) instanceof AggregateError);
Tests
Simply clone the repo, npm install
, and run npm test