1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 13:03:18 +00:00
musix-oss/node_modules/core-js/modules/esnext.aggregate-error.js
2019-10-10 16:43:04 +03:00

30 lines
1.1 KiB
JavaScript

var $ = require('../internals/export');
var getPrototypeOf = require('../internals/object-get-prototype-of');
var setPrototypeOf = require('../internals/object-set-prototype-of');
var create = require('../internals/object-create');
var createPropertyDescriptor = require('../internals/create-property-descriptor');
var iterate = require('../internals/iterate');
var hide = require('../internals/hide');
var $AggregateError = function AggregateError(errors, message) {
var that = this;
if (!(that instanceof $AggregateError)) return new $AggregateError(errors, message);
if (setPrototypeOf) {
that = setPrototypeOf(new Error(message), getPrototypeOf(that));
}
var errorsArray = [];
iterate(errors, errorsArray.push, errorsArray);
hide(that, 'errors', errorsArray);
if (message !== undefined) hide(that, 'message', String(message));
return that;
};
$AggregateError.prototype = create(Error.prototype, {
constructor: createPropertyDescriptor(5, $AggregateError),
name: createPropertyDescriptor(5, 'AggregateError')
});
$({ global: true }, {
AggregateError: $AggregateError
});