-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimplementation.js
37 lines (28 loc) · 1.26 KB
/
implementation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
var CreateMethodProperty = require('es-abstract/2023/CreateMethodProperty');
var CreateNonEnumerableDataPropertyOrThrow = require('es-abstract/2023/CreateNonEnumerableDataPropertyOrThrow');
var OrdinarySetPrototypeOf = require('es-abstract/2023/OrdinarySetPrototypeOf');
var hasPropertyDescriptors = require('has-property-descriptors')();
var $Error = require('es-errors');
// eslint-disable-next-line func-style
function SuppressedError(error, suppressed, message) {
var O = new $Error(message);
OrdinarySetPrototypeOf(O, proto); // eslint-disable-line no-use-before-define
delete O.constructor;
CreateNonEnumerableDataPropertyOrThrow(O, 'error', error);
CreateNonEnumerableDataPropertyOrThrow(O, 'suppressed', suppressed);
return O;
}
if (hasPropertyDescriptors) {
Object.defineProperty(SuppressedError, 'prototype', { writable: false });
}
var proto = SuppressedError.prototype;
if (
!CreateMethodProperty(proto, 'constructor', SuppressedError)
|| !CreateMethodProperty(proto, 'message', '')
|| !CreateMethodProperty(proto, 'name', 'SuppressedError')
) {
throw new $Error('unable to install SuppressedError.prototype properties; please report this!');
}
OrdinarySetPrototypeOf(SuppressedError.prototype, $Error.prototype);
module.exports = SuppressedError;