Skip to content

Commit

Permalink
fix errors subclassing
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Dec 9, 2021
1 parent 747d93e commit ab655db
Showing 1 changed file with 2 additions and 2 deletions.
@@ -1,9 +1,9 @@
'use strict';
var getBuiltIn = require('../internals/get-built-in');
var global = require('../internals/global');
var apply = require('../internals/function-apply');
var hasOwn = require('../internals/has-own-property');
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
var isPrototypeOf = require('../internals/object-is-prototype-of');
var setPrototypeOf = require('../internals/object-set-prototype-of');
var copyConstructorProperties = require('../internals/copy-constructor-properties');
var inheritIfRequired = require('../internals/inherit-if-required');
Expand All @@ -30,7 +30,7 @@ module.exports = function (ERROR_NAME, wrapper, FORCED, IS_AGGREGATE_ERROR) {
var WrappedError = wrapper(function () {
var result = apply(OriginalError, this, arguments);
if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(result, 'stack', clearErrorStack(result.stack, 2));
if (this && this !== global) inheritIfRequired(result, this, WrappedError);
if (this && isPrototypeOf(OriginalErrorPrototype, this)) inheritIfRequired(result, this, WrappedError);
if (arguments.length > OPTIONS_POSITION) installErrorCause(result, arguments[OPTIONS_POSITION]);
return result;
});
Expand Down

0 comments on commit ab655db

Please sign in to comment.