Skip to content

Commit

Permalink
fix the prototype chain of AggregateError constructor that should c…
Browse files Browse the repository at this point in the history
…ontain `Error` constructor
  • Loading branch information
zloirock committed Oct 10, 2021
1 parent bfa96a5 commit bcdbdb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Changelog
##### Unreleased
- Fixed the prototype chain of `AggregateError` constructor that should contain `Error` constructor
- Fixed incorrect `AggregateError.prototype` properties descriptors
- Fixed `InstallErrorCause` internal operation
- Added NodeJS 16.11 compat data mapping
- `Object.hasOwn` marked as supported from Safari 15.1

Expand Down
4 changes: 4 additions & 0 deletions packages/core-js/modules/es.aggregate-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
var $ = require('../internals/export');
var getPrototypeOf = require('../internals/object-get-prototype-of');
var setPrototypeOf = require('../internals/object-set-prototype-of');
var copyConstructorProperties = require('../internals/copy-constructor-properties');
var create = require('../internals/object-create');
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
var createPropertyDescriptor = require('../internals/create-property-descriptor');
Expand All @@ -25,6 +26,9 @@ var $AggregateError = function AggregateError(errors, message /* , options */) {
return that;
};

if (setPrototypeOf) setPrototypeOf($AggregateError, Error);
else copyConstructorProperties($AggregateError, Error);

$AggregateError.prototype = create(Error.prototype, {
constructor: createPropertyDescriptor(1, $AggregateError),
message: createPropertyDescriptor(1, ''),
Expand Down

0 comments on commit bcdbdb7

Please sign in to comment.