ses 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEWS.md +20 -0
- package/dist/lockdown.cjs +150 -61
- package/dist/lockdown.mjs +150 -61
- package/dist/lockdown.umd.js +150 -61
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses.cjs +150 -61
- package/dist/ses.mjs +150 -61
- package/dist/ses.umd.js +150 -61
- package/dist/ses.umd.min.js +1 -1
- package/package.json +7 -6
- package/src/commons.js +1 -0
- package/src/enablements.js +6 -0
- package/src/error/assert.js +37 -9
- package/src/error/console.js +10 -0
- package/src/error/internal-types.js +6 -1
- package/src/error/tame-console.js +8 -8
- package/src/error/types.js +45 -27
- package/src/permits.js +25 -7
- package/types.d.ts +16 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ses",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Hardened JavaScript for Fearless Cooperation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lockdown",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"@endo/env-options": "^1.1.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@endo/compartment-mapper": "^1.1.
|
|
73
|
-
"@endo/static-module-record": "^1.0.
|
|
74
|
-
"@endo/test262-runner": "^0.1.
|
|
72
|
+
"@endo/compartment-mapper": "^1.1.2",
|
|
73
|
+
"@endo/static-module-record": "^1.0.4",
|
|
74
|
+
"@endo/test262-runner": "^0.1.34",
|
|
75
75
|
"ava": "^5.3.0",
|
|
76
76
|
"babel-eslint": "^10.0.3",
|
|
77
77
|
"c8": "^7.14.0",
|
|
@@ -161,7 +161,8 @@
|
|
|
161
161
|
"isNaN",
|
|
162
162
|
"parseFloat",
|
|
163
163
|
"parseInt",
|
|
164
|
-
"unescape"
|
|
164
|
+
"unescape",
|
|
165
|
+
"AggregateError"
|
|
165
166
|
],
|
|
166
167
|
"@endo/no-polymorphic-call": "error"
|
|
167
168
|
},
|
|
@@ -188,5 +189,5 @@
|
|
|
188
189
|
"typeCoverage": {
|
|
189
190
|
"atLeast": 81.17
|
|
190
191
|
},
|
|
191
|
-
"gitHead": "
|
|
192
|
+
"gitHead": "297fed572fedec0e1ae3ce34cf409f9d45233d43"
|
|
192
193
|
}
|
package/src/commons.js
CHANGED
package/src/enablements.js
CHANGED
|
@@ -149,6 +149,12 @@ export const moderateEnablements = {
|
|
|
149
149
|
name: true, // set by "node 14"
|
|
150
150
|
},
|
|
151
151
|
|
|
152
|
+
// https://github.com/endojs/endo/issues/550
|
|
153
|
+
'%AggregateErrorPrototype%': {
|
|
154
|
+
message: true, // to match TypeErrorPrototype.message
|
|
155
|
+
name: true, // set by "node 14"?
|
|
156
|
+
},
|
|
157
|
+
|
|
152
158
|
'%PromisePrototype%': {
|
|
153
159
|
constructor: true, // set by "core-js"
|
|
154
160
|
},
|
package/src/error/assert.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
arrayPush,
|
|
22
22
|
assign,
|
|
23
23
|
freeze,
|
|
24
|
+
defineProperty,
|
|
24
25
|
globalThis,
|
|
25
26
|
is,
|
|
26
27
|
isError,
|
|
@@ -33,6 +34,7 @@ import {
|
|
|
33
34
|
weakmapGet,
|
|
34
35
|
weakmapHas,
|
|
35
36
|
weakmapSet,
|
|
37
|
+
AggregateError,
|
|
36
38
|
} from '../commons.js';
|
|
37
39
|
import { an, bestEffortStringify } from './stringify-utils.js';
|
|
38
40
|
import './types.js';
|
|
@@ -257,8 +259,8 @@ const tagError = (err, optErrorName = err.name) => {
|
|
|
257
259
|
*/
|
|
258
260
|
const makeError = (
|
|
259
261
|
optDetails = redactedDetails`Assert failed`,
|
|
260
|
-
|
|
261
|
-
{ errorName = undefined } = {},
|
|
262
|
+
errConstructor = globalThis.Error,
|
|
263
|
+
{ errorName = undefined, cause = undefined, errors = undefined } = {},
|
|
262
264
|
) => {
|
|
263
265
|
if (typeof optDetails === 'string') {
|
|
264
266
|
// If it is a string, use it as the literal part of the template so
|
|
@@ -270,7 +272,29 @@ const makeError = (
|
|
|
270
272
|
throw TypeError(`unrecognized details ${quote(optDetails)}`);
|
|
271
273
|
}
|
|
272
274
|
const messageString = getMessageString(hiddenDetails);
|
|
273
|
-
const
|
|
275
|
+
const opts = cause && { cause };
|
|
276
|
+
let error;
|
|
277
|
+
if (
|
|
278
|
+
typeof AggregateError !== 'undefined' &&
|
|
279
|
+
errConstructor === AggregateError
|
|
280
|
+
) {
|
|
281
|
+
error = AggregateError(errors || [], messageString, opts);
|
|
282
|
+
} else {
|
|
283
|
+
error = /** @type {ErrorConstructor} */ (errConstructor)(
|
|
284
|
+
messageString,
|
|
285
|
+
opts,
|
|
286
|
+
);
|
|
287
|
+
if (errors !== undefined) {
|
|
288
|
+
// Since we need to tolerate `errors` on an AggregateError, may as
|
|
289
|
+
// well tolerate it on all errors.
|
|
290
|
+
defineProperty(error, 'errors', {
|
|
291
|
+
value: errors,
|
|
292
|
+
writable: true,
|
|
293
|
+
enumerable: false,
|
|
294
|
+
configurable: true,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
274
298
|
weakmapSet(hiddenMessageLogArgs, error, getLogArgs(hiddenDetails));
|
|
275
299
|
if (errorName !== undefined) {
|
|
276
300
|
tagError(error, errorName);
|
|
@@ -382,9 +406,10 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
|
382
406
|
/** @type {AssertFail} */
|
|
383
407
|
const fail = (
|
|
384
408
|
optDetails = assertFailedDetails,
|
|
385
|
-
|
|
409
|
+
errConstructor = undefined,
|
|
410
|
+
options = undefined,
|
|
386
411
|
) => {
|
|
387
|
-
const reason = makeError(optDetails,
|
|
412
|
+
const reason = makeError(optDetails, errConstructor, options);
|
|
388
413
|
if (optRaise !== undefined) {
|
|
389
414
|
optRaise(reason);
|
|
390
415
|
}
|
|
@@ -402,9 +427,10 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
|
402
427
|
function baseAssert(
|
|
403
428
|
flag,
|
|
404
429
|
optDetails = undefined,
|
|
405
|
-
|
|
430
|
+
errConstructor = undefined,
|
|
431
|
+
options = undefined,
|
|
406
432
|
) {
|
|
407
|
-
flag || fail(optDetails,
|
|
433
|
+
flag || fail(optDetails, errConstructor, options);
|
|
408
434
|
}
|
|
409
435
|
|
|
410
436
|
/** @type {AssertEqual} */
|
|
@@ -412,12 +438,14 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
|
|
|
412
438
|
actual,
|
|
413
439
|
expected,
|
|
414
440
|
optDetails = undefined,
|
|
415
|
-
|
|
441
|
+
errConstructor = undefined,
|
|
442
|
+
options = undefined,
|
|
416
443
|
) => {
|
|
417
444
|
is(actual, expected) ||
|
|
418
445
|
fail(
|
|
419
446
|
optDetails || details`Expected ${actual} is same as ${expected}`,
|
|
420
|
-
|
|
447
|
+
errConstructor || RangeError,
|
|
448
|
+
options,
|
|
421
449
|
);
|
|
422
450
|
};
|
|
423
451
|
freeze(equal);
|
package/src/error/console.js
CHANGED
|
@@ -169,6 +169,8 @@ export { makeLoggingConsoleKit };
|
|
|
169
169
|
const ErrorInfo = {
|
|
170
170
|
NOTE: 'ERROR_NOTE:',
|
|
171
171
|
MESSAGE: 'ERROR_MESSAGE:',
|
|
172
|
+
CAUSE: 'cause:',
|
|
173
|
+
ERRORS: 'errors:',
|
|
172
174
|
};
|
|
173
175
|
freeze(ErrorInfo);
|
|
174
176
|
|
|
@@ -308,6 +310,14 @@ const makeCausalConsole = (baseConsole, loggedErrorHandler) => {
|
|
|
308
310
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
309
311
|
baseConsole[severity](stackString);
|
|
310
312
|
// Show the other annotations on error
|
|
313
|
+
if (error.cause) {
|
|
314
|
+
logErrorInfo(severity, error, ErrorInfo.CAUSE, [error.cause], subErrors);
|
|
315
|
+
}
|
|
316
|
+
// @ts-expect-error AggregateError has an `errors` property.
|
|
317
|
+
if (error.errors) {
|
|
318
|
+
// @ts-expect-error AggregateError has an `errors` property.
|
|
319
|
+
logErrorInfo(severity, error, ErrorInfo.ERRORS, error.errors, subErrors);
|
|
320
|
+
}
|
|
311
321
|
for (const noteLogArgs of noteLogArgsArray) {
|
|
312
322
|
logErrorInfo(severity, error, ErrorInfo.NOTE, noteLogArgs, subErrors);
|
|
313
323
|
}
|
|
@@ -58,14 +58,14 @@ export const tameConsole = (
|
|
|
58
58
|
typeof globalThis.console !== 'undefined'
|
|
59
59
|
? globalThis.console
|
|
60
60
|
: typeof globalThis.print === 'function'
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
? // Make a good-enough console for eshost (including only functions that
|
|
62
|
+
// log at a specific level with no special argument interpretation).
|
|
63
|
+
// https://console.spec.whatwg.org/#logging
|
|
64
|
+
(p => freeze({ debug: p, log: p, info: p, warn: p, error: p }))(
|
|
65
|
+
// eslint-disable-next-line no-undef
|
|
66
|
+
wrapLogger(globalThis.print),
|
|
67
|
+
)
|
|
68
|
+
: undefined
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
// Upgrade a log-only console (as in `eshost -h SpiderMonkey`).
|
package/src/error/types.js
CHANGED
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* TypeScript does not treat `AggregateErrorConstructor` as a subtype of
|
|
5
|
+
* `ErrorConstructor`, which makes sense because their constructors
|
|
6
|
+
* have incompatible signatures. However, we want to parameterize some
|
|
7
|
+
* operations by any error constructor, including possible `AggregateError`.
|
|
8
|
+
* So we introduce `GenericErrorConstructor` as a common supertype. Any call
|
|
9
|
+
* to it to make an instance must therefore first case split on whether the
|
|
10
|
+
* constructor is an AggregateErrorConstructor or a normal ErrorConstructor.
|
|
11
|
+
*
|
|
12
|
+
* @typedef {ErrorConstructor | AggregateErrorConstructor} GenericErrorConstructor
|
|
13
|
+
*/
|
|
14
|
+
|
|
3
15
|
/**
|
|
4
16
|
* @callback BaseAssert
|
|
5
17
|
* The `assert` function itself.
|
|
6
18
|
*
|
|
7
19
|
* @param {any} flag The truthy/falsy value
|
|
8
|
-
* @param {Details
|
|
9
|
-
* @param {
|
|
10
|
-
* constructor to use.
|
|
20
|
+
* @param {Details} [optDetails] The details to throw
|
|
21
|
+
* @param {GenericErrorConstructor} [errConstructor]
|
|
22
|
+
* An optional alternate error constructor to use.
|
|
23
|
+
* @param {AssertMakeErrorOptions} [options]
|
|
11
24
|
* @returns {asserts flag}
|
|
12
25
|
*/
|
|
13
26
|
|
|
14
27
|
/**
|
|
15
28
|
* @typedef {object} AssertMakeErrorOptions
|
|
16
|
-
* @property {string
|
|
29
|
+
* @property {string} [errorName]
|
|
30
|
+
* @property {Error} [cause]
|
|
31
|
+
* @property {Error[]} [errors]
|
|
32
|
+
* Normally only used when the ErrorConstuctor is `AggregateError`
|
|
17
33
|
*/
|
|
18
34
|
|
|
19
35
|
/**
|
|
@@ -22,10 +38,10 @@
|
|
|
22
38
|
* The `assert.error` method, recording details for the console.
|
|
23
39
|
*
|
|
24
40
|
* The optional `optDetails` can be a string.
|
|
25
|
-
* @param {Details
|
|
26
|
-
* @param {
|
|
27
|
-
* constructor to use.
|
|
28
|
-
* @param {AssertMakeErrorOptions
|
|
41
|
+
* @param {Details} [optDetails] The details of what was asserted
|
|
42
|
+
* @param {GenericErrorConstructor} [errConstructor]
|
|
43
|
+
* An optional alternate error constructor to use.
|
|
44
|
+
* @param {AssertMakeErrorOptions} [options]
|
|
29
45
|
* @returns {Error}
|
|
30
46
|
*/
|
|
31
47
|
|
|
@@ -40,9 +56,10 @@
|
|
|
40
56
|
*
|
|
41
57
|
* The optional `optDetails` can be a string for backwards compatibility
|
|
42
58
|
* with the nodejs assertion library.
|
|
43
|
-
* @param {Details
|
|
44
|
-
* @param {
|
|
45
|
-
* constructor to use.
|
|
59
|
+
* @param {Details} [optDetails] The details of what was asserted
|
|
60
|
+
* @param {GenericErrorConstructor} [errConstructor]
|
|
61
|
+
* An optional alternate error constructor to use.
|
|
62
|
+
* @param {AssertMakeErrorOptions} [options]
|
|
46
63
|
* @returns {never}
|
|
47
64
|
*/
|
|
48
65
|
|
|
@@ -53,9 +70,10 @@
|
|
|
53
70
|
* Assert that two values must be `Object.is`.
|
|
54
71
|
* @param {any} actual The value we received
|
|
55
72
|
* @param {any} expected What we wanted
|
|
56
|
-
* @param {Details
|
|
57
|
-
* @param {
|
|
58
|
-
* constructor to use.
|
|
73
|
+
* @param {Details} [optDetails] The details to throw
|
|
74
|
+
* @param {GenericErrorConstructor} [errConstructor]
|
|
75
|
+
* An optional alternate error constructor to use.
|
|
76
|
+
* @param {AssertMakeErrorOptions} [options]
|
|
59
77
|
* @returns {void}
|
|
60
78
|
*/
|
|
61
79
|
|
|
@@ -66,7 +84,7 @@
|
|
|
66
84
|
* @callback AssertTypeofBigint
|
|
67
85
|
* @param {any} specimen
|
|
68
86
|
* @param {'bigint'} typename
|
|
69
|
-
* @param {Details
|
|
87
|
+
* @param {Details} [optDetails]
|
|
70
88
|
* @returns {asserts specimen is bigint}
|
|
71
89
|
*/
|
|
72
90
|
|
|
@@ -74,7 +92,7 @@
|
|
|
74
92
|
* @callback AssertTypeofBoolean
|
|
75
93
|
* @param {any} specimen
|
|
76
94
|
* @param {'boolean'} typename
|
|
77
|
-
* @param {Details
|
|
95
|
+
* @param {Details} [optDetails]
|
|
78
96
|
* @returns {asserts specimen is boolean}
|
|
79
97
|
*/
|
|
80
98
|
|
|
@@ -82,7 +100,7 @@
|
|
|
82
100
|
* @callback AssertTypeofFunction
|
|
83
101
|
* @param {any} specimen
|
|
84
102
|
* @param {'function'} typename
|
|
85
|
-
* @param {Details
|
|
103
|
+
* @param {Details} [optDetails]
|
|
86
104
|
* @returns {asserts specimen is Function}
|
|
87
105
|
*/
|
|
88
106
|
|
|
@@ -90,7 +108,7 @@
|
|
|
90
108
|
* @callback AssertTypeofNumber
|
|
91
109
|
* @param {any} specimen
|
|
92
110
|
* @param {'number'} typename
|
|
93
|
-
* @param {Details
|
|
111
|
+
* @param {Details} [optDetails]
|
|
94
112
|
* @returns {asserts specimen is number}
|
|
95
113
|
*/
|
|
96
114
|
|
|
@@ -98,7 +116,7 @@
|
|
|
98
116
|
* @callback AssertTypeofObject
|
|
99
117
|
* @param {any} specimen
|
|
100
118
|
* @param {'object'} typename
|
|
101
|
-
* @param {Details
|
|
119
|
+
* @param {Details} [optDetails]
|
|
102
120
|
* @returns {asserts specimen is Record<any, any> | null}
|
|
103
121
|
*/
|
|
104
122
|
|
|
@@ -106,7 +124,7 @@
|
|
|
106
124
|
* @callback AssertTypeofString
|
|
107
125
|
* @param {any} specimen
|
|
108
126
|
* @param {'string'} typename
|
|
109
|
-
* @param {Details
|
|
127
|
+
* @param {Details} [optDetails]
|
|
110
128
|
* @returns {asserts specimen is string}
|
|
111
129
|
*/
|
|
112
130
|
|
|
@@ -114,7 +132,7 @@
|
|
|
114
132
|
* @callback AssertTypeofSymbol
|
|
115
133
|
* @param {any} specimen
|
|
116
134
|
* @param {'symbol'} typename
|
|
117
|
-
* @param {Details
|
|
135
|
+
* @param {Details} [optDetails]
|
|
118
136
|
* @returns {asserts specimen is symbol}
|
|
119
137
|
*/
|
|
120
138
|
|
|
@@ -122,7 +140,7 @@
|
|
|
122
140
|
* @callback AssertTypeofUndefined
|
|
123
141
|
* @param {any} specimen
|
|
124
142
|
* @param {'undefined'} typename
|
|
125
|
-
* @param {Details
|
|
143
|
+
* @param {Details} [optDetails]
|
|
126
144
|
* @returns {asserts specimen is undefined}
|
|
127
145
|
*/
|
|
128
146
|
|
|
@@ -141,7 +159,7 @@
|
|
|
141
159
|
*
|
|
142
160
|
* Assert an expected typeof result.
|
|
143
161
|
* @param {any} specimen The value to get the typeof
|
|
144
|
-
* @param {Details
|
|
162
|
+
* @param {Details} [optDetails] The details to throw
|
|
145
163
|
* @returns {asserts specimen is string}
|
|
146
164
|
*/
|
|
147
165
|
|
|
@@ -202,7 +220,7 @@
|
|
|
202
220
|
*
|
|
203
221
|
* @callback AssertQuote
|
|
204
222
|
* @param {any} payload What to declassify
|
|
205
|
-
* @param {(string|number)
|
|
223
|
+
* @param {(string|number)} [spaces]
|
|
206
224
|
* @returns {StringablePayload} The declassified payload
|
|
207
225
|
*/
|
|
208
226
|
|
|
@@ -235,8 +253,8 @@
|
|
|
235
253
|
* `optRaise` returns normally, which would be unusual, the throw following
|
|
236
254
|
* `optRaise(reason)` would still happen.
|
|
237
255
|
*
|
|
238
|
-
* @param {Raise
|
|
239
|
-
* @param {boolean
|
|
256
|
+
* @param {Raise} [optRaise]
|
|
257
|
+
* @param {boolean} [unredacted]
|
|
240
258
|
* @returns {Assert}
|
|
241
259
|
*/
|
|
242
260
|
|
|
@@ -400,6 +418,6 @@
|
|
|
400
418
|
* @callback FilterConsole
|
|
401
419
|
* @param {VirtualConsole} baseConsole
|
|
402
420
|
* @param {ConsoleFilter} filter
|
|
403
|
-
* @param {string
|
|
421
|
+
* @param {string} [topic]
|
|
404
422
|
* @returns {VirtualConsole}
|
|
405
423
|
*/
|
package/src/permits.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-restricted-globals */
|
|
2
|
+
/* eslint max-lines: 0 */
|
|
3
|
+
|
|
4
|
+
import { arrayPush } from './commons.js';
|
|
5
|
+
|
|
2
6
|
/**
|
|
3
7
|
* @file Exports {@code whitelist}, a recursively defined
|
|
4
8
|
* JSON record enumerating all intrinsics and their properties
|
|
@@ -8,8 +12,6 @@
|
|
|
8
12
|
* @author Mark S. Miller
|
|
9
13
|
*/
|
|
10
14
|
|
|
11
|
-
/* eslint max-lines: 0 */
|
|
12
|
-
|
|
13
15
|
/**
|
|
14
16
|
* constantProperties
|
|
15
17
|
* non-configurable, non-writable data properties of all global objects.
|
|
@@ -82,6 +84,8 @@ export const universalPropertyNames = {
|
|
|
82
84
|
Iterator: 'Iterator',
|
|
83
85
|
// https://github.com/tc39/proposal-async-iterator-helpers
|
|
84
86
|
AsyncIterator: 'AsyncIterator',
|
|
87
|
+
// https://github.com/endojs/endo/issues/550
|
|
88
|
+
AggregateError: 'AggregateError',
|
|
85
89
|
|
|
86
90
|
// *** Other Properties of the Global Object
|
|
87
91
|
|
|
@@ -185,16 +189,27 @@ export const uniqueGlobalPropertyNames = {
|
|
|
185
189
|
|
|
186
190
|
// All the "subclasses" of Error. These are collectively represented in the
|
|
187
191
|
// ECMAScript spec by the meta variable NativeError.
|
|
188
|
-
|
|
189
|
-
|
|
192
|
+
/** @type {GenericErrorConstructor[]} */
|
|
193
|
+
const NativeErrors = [
|
|
190
194
|
EvalError,
|
|
191
195
|
RangeError,
|
|
192
196
|
ReferenceError,
|
|
193
197
|
SyntaxError,
|
|
194
198
|
TypeError,
|
|
195
199
|
URIError,
|
|
200
|
+
// https://github.com/endojs/endo/issues/550
|
|
201
|
+
// Commented out to accommodate platforms prior to AggregateError.
|
|
202
|
+
// Instead, conditional push below.
|
|
203
|
+
// AggregateError,
|
|
196
204
|
];
|
|
197
205
|
|
|
206
|
+
if (typeof AggregateError !== 'undefined') {
|
|
207
|
+
// Conditional, to accommodate platforms prior to AggregateError
|
|
208
|
+
arrayPush(NativeErrors, AggregateError);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export { NativeErrors };
|
|
212
|
+
|
|
198
213
|
/**
|
|
199
214
|
* <p>Each JSON record enumerates the disposition of the properties on
|
|
200
215
|
* some corresponding intrinsic object.
|
|
@@ -599,6 +614,8 @@ export const permitted = {
|
|
|
599
614
|
SyntaxError: NativeError('%SyntaxErrorPrototype%'),
|
|
600
615
|
TypeError: NativeError('%TypeErrorPrototype%'),
|
|
601
616
|
URIError: NativeError('%URIErrorPrototype%'),
|
|
617
|
+
// https://github.com/endojs/endo/issues/550
|
|
618
|
+
AggregateError: NativeError('%AggregateErrorPrototype%'),
|
|
602
619
|
|
|
603
620
|
'%EvalErrorPrototype%': NativeErrorPrototype('EvalError'),
|
|
604
621
|
'%RangeErrorPrototype%': NativeErrorPrototype('RangeError'),
|
|
@@ -606,6 +623,8 @@ export const permitted = {
|
|
|
606
623
|
'%SyntaxErrorPrototype%': NativeErrorPrototype('SyntaxError'),
|
|
607
624
|
'%TypeErrorPrototype%': NativeErrorPrototype('TypeError'),
|
|
608
625
|
'%URIErrorPrototype%': NativeErrorPrototype('URIError'),
|
|
626
|
+
// https://github.com/endojs/endo/issues/550
|
|
627
|
+
'%AggregateErrorPrototype%': NativeErrorPrototype('AggregateError'),
|
|
609
628
|
|
|
610
629
|
// *** Numbers and Dates
|
|
611
630
|
|
|
@@ -1473,9 +1492,8 @@ export const permitted = {
|
|
|
1473
1492
|
'[[Proto]]': '%FunctionPrototype%',
|
|
1474
1493
|
all: fn,
|
|
1475
1494
|
allSettled: fn,
|
|
1476
|
-
//
|
|
1477
|
-
|
|
1478
|
-
any: false, // ES2021
|
|
1495
|
+
// https://github.com/Agoric/SES-shim/issues/550
|
|
1496
|
+
any: fn,
|
|
1479
1497
|
prototype: '%PromisePrototype%',
|
|
1480
1498
|
race: fn,
|
|
1481
1499
|
reject: fn,
|
package/types.d.ts
CHANGED
|
@@ -119,6 +119,8 @@ export type Details = string | DetailsToken;
|
|
|
119
119
|
|
|
120
120
|
export interface AssertMakeErrorOptions {
|
|
121
121
|
errorName?: string;
|
|
122
|
+
cause?: Error;
|
|
123
|
+
errors?: Error[];
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
type AssertTypeofBigint = (
|
|
@@ -175,6 +177,10 @@ interface ToStringable {
|
|
|
175
177
|
toString(): string;
|
|
176
178
|
}
|
|
177
179
|
|
|
180
|
+
export type GenericErrorConstructor =
|
|
181
|
+
| ErrorConstructor
|
|
182
|
+
| AggregateErrorConstructor;
|
|
183
|
+
|
|
178
184
|
export type Raise = (reason: Error) => void;
|
|
179
185
|
// Behold: recursion.
|
|
180
186
|
// eslint-disable-next-line no-use-before-define
|
|
@@ -184,23 +190,29 @@ export interface AssertionFunctions {
|
|
|
184
190
|
(
|
|
185
191
|
value: any,
|
|
186
192
|
details?: Details,
|
|
187
|
-
|
|
193
|
+
errConstructor?: GenericErrorConstructor,
|
|
194
|
+
options?: AssertMakeErrorOptions,
|
|
188
195
|
): asserts value;
|
|
189
196
|
typeof: AssertTypeof;
|
|
190
197
|
equal(
|
|
191
198
|
left: any,
|
|
192
199
|
right: any,
|
|
193
200
|
details?: Details,
|
|
194
|
-
|
|
201
|
+
errConstructor?: GenericErrorConstructor,
|
|
202
|
+
options?: AssertMakeErrorOptions,
|
|
195
203
|
): void;
|
|
196
204
|
string(specimen: any, details?: Details): asserts specimen is string;
|
|
197
|
-
fail(
|
|
205
|
+
fail(
|
|
206
|
+
details?: Details,
|
|
207
|
+
errConstructor?: GenericErrorConstructor,
|
|
208
|
+
options?: AssertMakeErrorOptions,
|
|
209
|
+
): never;
|
|
198
210
|
}
|
|
199
211
|
|
|
200
212
|
export interface AssertionUtilities {
|
|
201
213
|
error(
|
|
202
214
|
details?: Details,
|
|
203
|
-
|
|
215
|
+
errConstructor?: GenericErrorConstructor,
|
|
204
216
|
options?: AssertMakeErrorOptions,
|
|
205
217
|
): Error;
|
|
206
218
|
note(error: Error, details: Details): void;
|