source: imaps-frontend/node_modules/core-js/modules/es.error.cause.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 2.6 KB
Line 
1'use strict';
2/* eslint-disable no-unused-vars -- required for functions `.length` */
3var $ = require('../internals/export');
4var globalThis = require('../internals/global-this');
5var apply = require('../internals/function-apply');
6var wrapErrorConstructorWithCause = require('../internals/wrap-error-constructor-with-cause');
7
8var WEB_ASSEMBLY = 'WebAssembly';
9var WebAssembly = globalThis[WEB_ASSEMBLY];
10
11// eslint-disable-next-line es/no-error-cause -- feature detection
12var FORCED = new Error('e', { cause: 7 }).cause !== 7;
13
14var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
15 var O = {};
16 O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED);
17 $({ global: true, constructor: true, arity: 1, forced: FORCED }, O);
18};
19
20var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
21 if (WebAssembly && WebAssembly[ERROR_NAME]) {
22 var O = {};
23 O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED);
24 $({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED }, O);
25 }
26};
27
28// https://tc39.es/ecma262/#sec-nativeerror
29exportGlobalErrorCauseWrapper('Error', function (init) {
30 return function Error(message) { return apply(init, this, arguments); };
31});
32exportGlobalErrorCauseWrapper('EvalError', function (init) {
33 return function EvalError(message) { return apply(init, this, arguments); };
34});
35exportGlobalErrorCauseWrapper('RangeError', function (init) {
36 return function RangeError(message) { return apply(init, this, arguments); };
37});
38exportGlobalErrorCauseWrapper('ReferenceError', function (init) {
39 return function ReferenceError(message) { return apply(init, this, arguments); };
40});
41exportGlobalErrorCauseWrapper('SyntaxError', function (init) {
42 return function SyntaxError(message) { return apply(init, this, arguments); };
43});
44exportGlobalErrorCauseWrapper('TypeError', function (init) {
45 return function TypeError(message) { return apply(init, this, arguments); };
46});
47exportGlobalErrorCauseWrapper('URIError', function (init) {
48 return function URIError(message) { return apply(init, this, arguments); };
49});
50exportWebAssemblyErrorCauseWrapper('CompileError', function (init) {
51 return function CompileError(message) { return apply(init, this, arguments); };
52});
53exportWebAssemblyErrorCauseWrapper('LinkError', function (init) {
54 return function LinkError(message) { return apply(init, this, arguments); };
55});
56exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) {
57 return function RuntimeError(message) { return apply(init, this, arguments); };
58});
Note: See TracBrowser for help on using the repository browser.