-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
12 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
/* eslint-disable no-unused-vars -- required for functions `.length` */ | ||
var $ = require('../internals/export'); | ||
var apply = require('../internals/function-apply'); | ||
var wrapErrorConstructorWithCause = require('../internals/wrap-error-constructor-with-cause'); | ||
|
||
var FORCED = Error('e', { cause: 7 }).cause !== 7; | ||
|
||
$({ global: true, forced: FORCED }, { | ||
Error: wrapErrorConstructorWithCause('Error', function (init) { | ||
return function Error(message) { return init.apply(this, arguments); }; | ||
return function Error(message) { return apply(init, this, arguments); }; | ||
}, FORCED) | ||
}); | ||
|
||
$({ global: true, forced: FORCED }, { | ||
EvalError: wrapErrorConstructorWithCause('EvalError', function (init) { | ||
return function EvalError(message) { return init.apply(this, arguments); }; | ||
return function EvalError(message) { return apply(init, this, arguments); }; | ||
}, FORCED), | ||
RangeError: wrapErrorConstructorWithCause('RangeError', function (init) { | ||
return function RangeError(message) { return init.apply(this, arguments); }; | ||
return function RangeError(message) { return apply(init, this, arguments); }; | ||
}, FORCED), | ||
ReferenceError: wrapErrorConstructorWithCause('ReferenceError', function (init) { | ||
return function ReferenceError(message) { return init.apply(this, arguments); }; | ||
return function ReferenceError(message) { return apply(init, this, arguments); }; | ||
}, FORCED), | ||
SyntaxError: wrapErrorConstructorWithCause('SyntaxError', function (init) { | ||
return function SyntaxError(message) { return init.apply(this, arguments); }; | ||
return function SyntaxError(message) { return apply(init, this, arguments); }; | ||
}, FORCED), | ||
TypeError: wrapErrorConstructorWithCause('TypeError', function (init) { | ||
return function TypeError(message) { return init.apply(this, arguments); }; | ||
return function TypeError(message) { return apply(init, this, arguments); }; | ||
}, FORCED), | ||
URIError: wrapErrorConstructorWithCause('URIError', function (init) { | ||
return function URIError(message) { return init.apply(this, arguments); }; | ||
return function URIError(message) { return apply(init, this, arguments); }; | ||
}, FORCED) | ||
}); |