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.
@@ -1,4 +1,4 @@
1
- // ses@1.2.0
1
+ // ses@1.3.0
2
2
  'use strict';
3
3
  (() => {
4
4
  const functors = [
@@ -51,8 +51,9 @@ const {
51
51
  RangeError,
52
52
  ReferenceError,
53
53
  SyntaxError,
54
- TypeError}=
55
- globalThis;$h‍_once.FERAL_ERROR(FERAL_ERROR);$h‍_once.RangeError(RangeError);$h‍_once.ReferenceError(ReferenceError);$h‍_once.SyntaxError(SyntaxError);$h‍_once.TypeError(TypeError);
54
+ TypeError,
55
+ AggregateError}=
56
+ globalThis;$h‍_once.FERAL_ERROR(FERAL_ERROR);$h‍_once.RangeError(RangeError);$h‍_once.ReferenceError(ReferenceError);$h‍_once.SyntaxError(SyntaxError);$h‍_once.TypeError(TypeError);$h‍_once.AggregateError(AggregateError);
56
57
 
57
58
  const {
58
59
  assign,
@@ -653,20 +654,36 @@ freeze(bestEffortStringify);
653
654
  // === functors[5] ===
654
655
  ({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; $h‍_imports([]); // @ts-check
655
656
 
657
+ /**
658
+ * TypeScript does not treat `AggregateErrorConstructor` as a subtype of
659
+ * `ErrorConstructor`, which makes sense because their constructors
660
+ * have incompatible signatures. However, we want to parameterize some
661
+ * operations by any error constructor, including possible `AggregateError`.
662
+ * So we introduce `GenericErrorConstructor` as a common supertype. Any call
663
+ * to it to make an instance must therefore first case split on whether the
664
+ * constructor is an AggregateErrorConstructor or a normal ErrorConstructor.
665
+ *
666
+ * @typedef {ErrorConstructor | AggregateErrorConstructor} GenericErrorConstructor
667
+ */
668
+
656
669
  /**
657
670
  * @callback BaseAssert
658
671
  * The `assert` function itself.
659
672
  *
660
673
  * @param {any} flag The truthy/falsy value
661
- * @param {Details=} optDetails The details to throw
662
- * @param {ErrorConstructor=} ErrorConstructor An optional alternate error
663
- * constructor to use.
674
+ * @param {Details} [optDetails] The details to throw
675
+ * @param {GenericErrorConstructor} [errConstructor]
676
+ * An optional alternate error constructor to use.
677
+ * @param {AssertMakeErrorOptions} [options]
664
678
  * @returns {asserts flag}
665
679
  */
666
680
 
667
681
  /**
668
682
  * @typedef {object} AssertMakeErrorOptions
669
- * @property {string=} errorName
683
+ * @property {string} [errorName]
684
+ * @property {Error} [cause]
685
+ * @property {Error[]} [errors]
686
+ * Normally only used when the ErrorConstuctor is `AggregateError`
670
687
  */
671
688
 
672
689
  /**
@@ -675,10 +692,10 @@ freeze(bestEffortStringify);
675
692
  * The `assert.error` method, recording details for the console.
676
693
  *
677
694
  * The optional `optDetails` can be a string.
678
- * @param {Details=} optDetails The details of what was asserted
679
- * @param {ErrorConstructor=} ErrorConstructor An optional alternate error
680
- * constructor to use.
681
- * @param {AssertMakeErrorOptions=} options
695
+ * @param {Details} [optDetails] The details of what was asserted
696
+ * @param {GenericErrorConstructor} [errConstructor]
697
+ * An optional alternate error constructor to use.
698
+ * @param {AssertMakeErrorOptions} [options]
682
699
  * @returns {Error}
683
700
  */
684
701
 
@@ -693,9 +710,10 @@ freeze(bestEffortStringify);
693
710
  *
694
711
  * The optional `optDetails` can be a string for backwards compatibility
695
712
  * with the nodejs assertion library.
696
- * @param {Details=} optDetails The details of what was asserted
697
- * @param {ErrorConstructor=} ErrorConstructor An optional alternate error
698
- * constructor to use.
713
+ * @param {Details} [optDetails] The details of what was asserted
714
+ * @param {GenericErrorConstructor} [errConstructor]
715
+ * An optional alternate error constructor to use.
716
+ * @param {AssertMakeErrorOptions} [options]
699
717
  * @returns {never}
700
718
  */
701
719
 
@@ -706,9 +724,10 @@ freeze(bestEffortStringify);
706
724
  * Assert that two values must be `Object.is`.
707
725
  * @param {any} actual The value we received
708
726
  * @param {any} expected What we wanted
709
- * @param {Details=} optDetails The details to throw
710
- * @param {ErrorConstructor=} ErrorConstructor An optional alternate error
711
- * constructor to use.
727
+ * @param {Details} [optDetails] The details to throw
728
+ * @param {GenericErrorConstructor} [errConstructor]
729
+ * An optional alternate error constructor to use.
730
+ * @param {AssertMakeErrorOptions} [options]
712
731
  * @returns {void}
713
732
  */
714
733
 
@@ -719,7 +738,7 @@ freeze(bestEffortStringify);
719
738
  * @callback AssertTypeofBigint
720
739
  * @param {any} specimen
721
740
  * @param {'bigint'} typename
722
- * @param {Details=} optDetails
741
+ * @param {Details} [optDetails]
723
742
  * @returns {asserts specimen is bigint}
724
743
  */
725
744
 
@@ -727,7 +746,7 @@ freeze(bestEffortStringify);
727
746
  * @callback AssertTypeofBoolean
728
747
  * @param {any} specimen
729
748
  * @param {'boolean'} typename
730
- * @param {Details=} optDetails
749
+ * @param {Details} [optDetails]
731
750
  * @returns {asserts specimen is boolean}
732
751
  */
733
752
 
@@ -735,7 +754,7 @@ freeze(bestEffortStringify);
735
754
  * @callback AssertTypeofFunction
736
755
  * @param {any} specimen
737
756
  * @param {'function'} typename
738
- * @param {Details=} optDetails
757
+ * @param {Details} [optDetails]
739
758
  * @returns {asserts specimen is Function}
740
759
  */
741
760
 
@@ -743,7 +762,7 @@ freeze(bestEffortStringify);
743
762
  * @callback AssertTypeofNumber
744
763
  * @param {any} specimen
745
764
  * @param {'number'} typename
746
- * @param {Details=} optDetails
765
+ * @param {Details} [optDetails]
747
766
  * @returns {asserts specimen is number}
748
767
  */
749
768
 
@@ -751,7 +770,7 @@ freeze(bestEffortStringify);
751
770
  * @callback AssertTypeofObject
752
771
  * @param {any} specimen
753
772
  * @param {'object'} typename
754
- * @param {Details=} optDetails
773
+ * @param {Details} [optDetails]
755
774
  * @returns {asserts specimen is Record<any, any> | null}
756
775
  */
757
776
 
@@ -759,7 +778,7 @@ freeze(bestEffortStringify);
759
778
  * @callback AssertTypeofString
760
779
  * @param {any} specimen
761
780
  * @param {'string'} typename
762
- * @param {Details=} optDetails
781
+ * @param {Details} [optDetails]
763
782
  * @returns {asserts specimen is string}
764
783
  */
765
784
 
@@ -767,7 +786,7 @@ freeze(bestEffortStringify);
767
786
  * @callback AssertTypeofSymbol
768
787
  * @param {any} specimen
769
788
  * @param {'symbol'} typename
770
- * @param {Details=} optDetails
789
+ * @param {Details} [optDetails]
771
790
  * @returns {asserts specimen is symbol}
772
791
  */
773
792
 
@@ -775,7 +794,7 @@ freeze(bestEffortStringify);
775
794
  * @callback AssertTypeofUndefined
776
795
  * @param {any} specimen
777
796
  * @param {'undefined'} typename
778
- * @param {Details=} optDetails
797
+ * @param {Details} [optDetails]
779
798
  * @returns {asserts specimen is undefined}
780
799
  */
781
800
 
@@ -794,7 +813,7 @@ freeze(bestEffortStringify);
794
813
  *
795
814
  * Assert an expected typeof result.
796
815
  * @param {any} specimen The value to get the typeof
797
- * @param {Details=} optDetails The details to throw
816
+ * @param {Details} [optDetails] The details to throw
798
817
  * @returns {asserts specimen is string}
799
818
  */
800
819
 
@@ -855,7 +874,7 @@ freeze(bestEffortStringify);
855
874
  *
856
875
  * @callback AssertQuote
857
876
  * @param {any} payload What to declassify
858
- * @param {(string|number)=} spaces
877
+ * @param {(string|number)} [spaces]
859
878
  * @returns {StringablePayload} The declassified payload
860
879
  */
861
880
 
@@ -888,8 +907,8 @@ freeze(bestEffortStringify);
888
907
  * `optRaise` returns normally, which would be unusual, the throw following
889
908
  * `optRaise(reason)` would still happen.
890
909
  *
891
- * @param {Raise=} optRaise
892
- * @param {boolean=} unredacted
910
+ * @param {Raise} [optRaise]
911
+ * @param {boolean} [unredacted]
893
912
  * @returns {Assert}
894
913
  */
895
914
 
@@ -1053,7 +1072,7 @@ freeze(bestEffortStringify);
1053
1072
  * @callback FilterConsole
1054
1073
  * @param {VirtualConsole} baseConsole
1055
1074
  * @param {ConsoleFilter} filter
1056
- * @param {string=} topic
1075
+ * @param {string} [topic]
1057
1076
  * @returns {VirtualConsole}
1058
1077
  */
1059
1078
  })()
@@ -1130,7 +1149,12 @@ freeze(bestEffortStringify);
1130
1149
  */
1131
1150
 
1132
1151
  /**
1133
- * @typedef {{ NOTE: 'ERROR_NOTE:', MESSAGE: 'ERROR_MESSAGE:' }} ErrorInfo
1152
+ * @typedef {{
1153
+ * NOTE: 'ERROR_NOTE:',
1154
+ * MESSAGE: 'ERROR_MESSAGE:',
1155
+ * CAUSE: 'cause:',
1156
+ * ERRORS: 'errors:',
1157
+ * }} ErrorInfo
1134
1158
  */
1135
1159
 
1136
1160
  /**
@@ -1451,7 +1475,9 @@ freeze(makeNoteLogArgsArrayKit);
1451
1475
  })()
1452
1476
  ,
1453
1477
  // === functors[9] ===
1454
- ({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,globalThis,is,isError,regexpTest,stringIndexOf,stringReplace,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,an,bestEffortStringify,makeNoteLogArgsArrayKit;$h‍_imports([["../commons.js", [["RangeError", [$h‍_a => (RangeError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPop", [$h‍_a => (arrayPop = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]],["regexpTest", [$h‍_a => (regexpTest = $h‍_a)]],["stringIndexOf", [$h‍_a => (stringIndexOf = $h‍_a)]],["stringReplace", [$h‍_a => (stringReplace = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]],["stringStartsWith", [$h‍_a => (stringStartsWith = $h‍_a)]],["weakmapDelete", [$h‍_a => (weakmapDelete = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapHas", [$h‍_a => (weakmapHas = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]]]],["./stringify-utils.js", [["an", [$h‍_a => (an = $h‍_a)]],["bestEffortStringify", [$h‍_a => (bestEffortStringify = $h‍_a)]]]],["./types.js", []],["./internal-types.js", []],["./note-log-args.js", [["makeNoteLogArgsArrayKit", [$h‍_a => (makeNoteLogArgsArrayKit = $h‍_a)]]]]]);
1478
+ ({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,defineProperty,globalThis,is,isError,regexpTest,stringIndexOf,stringReplace,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,AggregateError,an,bestEffortStringify,makeNoteLogArgsArrayKit;$h‍_imports([["../commons.js", [["RangeError", [$h‍_a => (RangeError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPop", [$h‍_a => (arrayPop = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]],["regexpTest", [$h‍_a => (regexpTest = $h‍_a)]],["stringIndexOf", [$h‍_a => (stringIndexOf = $h‍_a)]],["stringReplace", [$h‍_a => (stringReplace = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]],["stringStartsWith", [$h‍_a => (stringStartsWith = $h‍_a)]],["weakmapDelete", [$h‍_a => (weakmapDelete = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapHas", [$h‍_a => (weakmapHas = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["AggregateError", [$h‍_a => (AggregateError = $h‍_a)]]]],["./stringify-utils.js", [["an", [$h‍_a => (an = $h‍_a)]],["bestEffortStringify", [$h‍_a => (bestEffortStringify = $h‍_a)]]]],["./types.js", []],["./internal-types.js", []],["./note-log-args.js", [["makeNoteLogArgsArrayKit", [$h‍_a => (makeNoteLogArgsArrayKit = $h‍_a)]]]]]);
1479
+
1480
+
1455
1481
 
1456
1482
 
1457
1483
 
@@ -1710,8 +1736,8 @@ const tagError= (err, optErrorName= err.name)=> {
1710
1736
  */
1711
1737
  const makeError= (
1712
1738
  optDetails= redactedDetails `Assert failed`,
1713
- ErrorConstructor= globalThis.Error,
1714
- { errorName= undefined}= {})=>
1739
+ errConstructor= globalThis.Error,
1740
+ { errorName= undefined, cause= undefined, errors= undefined}= {})=>
1715
1741
  {
1716
1742
  if( typeof optDetails=== 'string') {
1717
1743
  // If it is a string, use it as the literal part of the template so
@@ -1723,7 +1749,29 @@ const makeError= (
1723
1749
  throw TypeError( `unrecognized details ${quote(optDetails)}`);
1724
1750
  }
1725
1751
  const messageString= getMessageString(hiddenDetails);
1726
- const error= new ErrorConstructor(messageString);
1752
+ const opts= cause&& { cause};
1753
+ let error;
1754
+ if(
1755
+ typeof AggregateError!== 'undefined'&&
1756
+ errConstructor=== AggregateError)
1757
+ {
1758
+ error= AggregateError(errors|| [], messageString, opts);
1759
+ }else {
1760
+ error= /** @type {ErrorConstructor} */ errConstructor(
1761
+ messageString,
1762
+ opts);
1763
+
1764
+ if( errors!== undefined) {
1765
+ // Since we need to tolerate `errors` on an AggregateError, may as
1766
+ // well tolerate it on all errors.
1767
+ defineProperty(error, 'errors', {
1768
+ value: errors,
1769
+ writable: true,
1770
+ enumerable: false,
1771
+ configurable: true});
1772
+
1773
+ }
1774
+ }
1727
1775
  weakmapSet(hiddenMessageLogArgs, error, getLogArgs(hiddenDetails));
1728
1776
  if( errorName!== undefined) {
1729
1777
  tagError(error, errorName);
@@ -1835,9 +1883,10 @@ const makeAssert= (optRaise= undefined, unredacted= false)=> {
1835
1883
  /** @type {AssertFail} */
1836
1884
  const fail= (
1837
1885
  optDetails= assertFailedDetails,
1838
- ErrorConstructor= globalThis.Error)=>
1886
+ errConstructor= undefined,
1887
+ options= undefined)=>
1839
1888
  {
1840
- const reason= makeError(optDetails, ErrorConstructor);
1889
+ const reason= makeError(optDetails, errConstructor, options);
1841
1890
  if( optRaise!== undefined) {
1842
1891
  optRaise(reason);
1843
1892
  }
@@ -1855,9 +1904,10 @@ const makeAssert= (optRaise= undefined, unredacted= false)=> {
1855
1904
  function baseAssert(
1856
1905
  flag,
1857
1906
  optDetails= undefined,
1858
- ErrorConstructor= undefined)
1907
+ errConstructor= undefined,
1908
+ options= undefined)
1859
1909
  {
1860
- flag|| fail(optDetails, ErrorConstructor);
1910
+ flag|| fail(optDetails, errConstructor, options);
1861
1911
  }
1862
1912
 
1863
1913
  /** @type {AssertEqual} */
@@ -1865,12 +1915,14 @@ const makeAssert= (optRaise= undefined, unredacted= false)=> {
1865
1915
  actual,
1866
1916
  expected,
1867
1917
  optDetails= undefined,
1868
- ErrorConstructor= undefined)=>
1918
+ errConstructor= undefined,
1919
+ options= undefined)=>
1869
1920
  {
1870
1921
  is(actual, expected)||
1871
1922
  fail(
1872
1923
  optDetails|| details `Expected ${actual} is same as ${expected}`,
1873
- ErrorConstructor|| RangeError);
1924
+ errConstructor|| RangeError,
1925
+ options);
1874
1926
 
1875
1927
  };
1876
1928
  freeze(equal);
@@ -2173,7 +2225,11 @@ const makeHardener= ()=> {
2173
2225
  })()
2174
2226
  ,
2175
2227
  // === functors[11] ===
2176
- ({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; $h‍_imports([]); /* eslint-disable no-restricted-globals */
2228
+ ({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let arrayPush;$h‍_imports([["./commons.js", [["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]]]]]);
2229
+
2230
+
2231
+
2232
+
2177
2233
  /**
2178
2234
  * @file Exports {@code whitelist}, a recursively defined
2179
2235
  * JSON record enumerating all intrinsics and their properties
@@ -2183,8 +2239,6 @@ const makeHardener= ()=> {
2183
2239
  * @author Mark S. Miller
2184
2240
  */
2185
2241
 
2186
- /* eslint max-lines: 0 */
2187
-
2188
2242
  /**
2189
2243
  * constantProperties
2190
2244
  * non-configurable, non-writable data properties of all global objects.
@@ -2257,6 +2311,8 @@ const universalPropertyNames= {
2257
2311
  Iterator: 'Iterator',
2258
2312
  // https://github.com/tc39/proposal-async-iterator-helpers
2259
2313
  AsyncIterator: 'AsyncIterator',
2314
+ // https://github.com/endojs/endo/issues/550
2315
+ AggregateError: 'AggregateError',
2260
2316
 
2261
2317
  // *** Other Properties of the Global Object
2262
2318
 
@@ -2360,14 +2416,25 @@ const uniqueGlobalPropertyNames= {
2360
2416
 
2361
2417
  // All the "subclasses" of Error. These are collectively represented in the
2362
2418
  // ECMAScript spec by the meta variable NativeError.
2363
- // TODO Add AggregateError https://github.com/Agoric/SES-shim/issues/550
2364
- $h‍_once.uniqueGlobalPropertyNames(uniqueGlobalPropertyNames);const NativeErrors=[
2419
+ /** @type {GenericErrorConstructor[]} */$h‍_once.uniqueGlobalPropertyNames(uniqueGlobalPropertyNames);
2420
+ const NativeErrors= [
2365
2421
  EvalError,
2366
2422
  RangeError,
2367
2423
  ReferenceError,
2368
2424
  SyntaxError,
2369
2425
  TypeError,
2370
- URIError];
2426
+ URIError
2427
+ // https://github.com/endojs/endo/issues/550
2428
+ // Commented out to accommodate platforms prior to AggregateError.
2429
+ // Instead, conditional push below.
2430
+ // AggregateError,
2431
+ ];$h‍_once.NativeErrors(NativeErrors);
2432
+
2433
+ if( typeof AggregateError!== 'undefined') {
2434
+ // Conditional, to accommodate platforms prior to AggregateError
2435
+ arrayPush(NativeErrors, AggregateError);
2436
+ }
2437
+
2371
2438
 
2372
2439
 
2373
2440
  /**
@@ -2417,7 +2484,7 @@ $h‍_once.uniqueGlobalPropertyNames(uniqueGlobalPropertyNames);const NativeErro
2417
2484
  */
2418
2485
 
2419
2486
  // Function Instances
2420
- $h‍_once.NativeErrors(NativeErrors);const FunctionInstance={
2487
+ const FunctionInstance= {
2421
2488
  '[[Proto]]': '%FunctionPrototype%',
2422
2489
  length: 'number',
2423
2490
  name: 'string'
@@ -2774,6 +2841,8 @@ const permitted= {
2774
2841
  SyntaxError: NativeError('%SyntaxErrorPrototype%'),
2775
2842
  TypeError: NativeError('%TypeErrorPrototype%'),
2776
2843
  URIError: NativeError('%URIErrorPrototype%'),
2844
+ // https://github.com/endojs/endo/issues/550
2845
+ AggregateError: NativeError('%AggregateErrorPrototype%'),
2777
2846
 
2778
2847
  '%EvalErrorPrototype%': NativeErrorPrototype('EvalError'),
2779
2848
  '%RangeErrorPrototype%': NativeErrorPrototype('RangeError'),
@@ -2781,6 +2850,8 @@ const permitted= {
2781
2850
  '%SyntaxErrorPrototype%': NativeErrorPrototype('SyntaxError'),
2782
2851
  '%TypeErrorPrototype%': NativeErrorPrototype('TypeError'),
2783
2852
  '%URIErrorPrototype%': NativeErrorPrototype('URIError'),
2853
+ // https://github.com/endojs/endo/issues/550
2854
+ '%AggregateErrorPrototype%': NativeErrorPrototype('AggregateError'),
2784
2855
 
2785
2856
  // *** Numbers and Dates
2786
2857
 
@@ -3648,9 +3719,8 @@ const permitted= {
3648
3719
  '[[Proto]]': '%FunctionPrototype%',
3649
3720
  all: fn,
3650
3721
  allSettled: fn,
3651
- // To transition from `false` to `fn` once we also have `AggregateError`
3652
- // TODO https://github.com/Agoric/SES-shim/issues/550
3653
- any: false, // ES2021
3722
+ // https://github.com/Agoric/SES-shim/issues/550
3723
+ any: fn,
3654
3724
  prototype: '%PromisePrototype%',
3655
3725
  race: fn,
3656
3726
  reject: fn,
@@ -4801,6 +4871,12 @@ const moderateEnablements= {
4801
4871
  name: true // set by "node 14"
4802
4872
  },
4803
4873
 
4874
+ // https://github.com/endojs/endo/issues/550
4875
+ '%AggregateErrorPrototype%': {
4876
+ message: true, // to match TypeErrorPrototype.message
4877
+ name: true // set by "node 14"?
4878
+ },
4879
+
4804
4880
  '%PromisePrototype%': {
4805
4881
  constructor: true // set by "core-js"
4806
4882
  },
@@ -6711,7 +6787,9 @@ freeze(makeLoggingConsoleKit);
6711
6787
  /** @type {ErrorInfo} */
6712
6788
  const ErrorInfo= {
6713
6789
  NOTE: 'ERROR_NOTE:',
6714
- MESSAGE: 'ERROR_MESSAGE:'};
6790
+ MESSAGE: 'ERROR_MESSAGE:',
6791
+ CAUSE: 'cause:',
6792
+ ERRORS: 'errors:'};
6715
6793
 
6716
6794
  freeze(ErrorInfo);
6717
6795
 
@@ -6851,6 +6929,14 @@ const makeCausalConsole= (baseConsole, loggedErrorHandler)=> {
6851
6929
  // eslint-disable-next-line @endo/no-polymorphic-call
6852
6930
  baseConsole[severity](stackString);
6853
6931
  // Show the other annotations on error
6932
+ if( error.cause) {
6933
+ logErrorInfo(severity, error, ErrorInfo.CAUSE, [error.cause], subErrors);
6934
+ }
6935
+ // @ts-expect-error AggregateError has an `errors` property.
6936
+ if( error.errors) {
6937
+ // @ts-expect-error AggregateError has an `errors` property.
6938
+ logErrorInfo(severity, error, ErrorInfo.ERRORS, error.errors, subErrors);
6939
+ }
6854
6940
  for( const noteLogArgs of noteLogArgsArray) {
6855
6941
  logErrorInfo(severity, error, ErrorInfo.NOTE, noteLogArgs, subErrors);
6856
6942
  }
@@ -7112,14 +7198,14 @@ const tameConsole= (
7112
7198
  typeof globalThis.console!== 'undefined'?
7113
7199
  globalThis.console:
7114
7200
  typeof globalThis.print=== 'function'?
7115
- // Make a good-enough console for eshost (including only functions that
7116
- // log at a specific level with no special argument interpretation).
7117
- // https://console.spec.whatwg.org/#logging
7118
- ((p)=>freeze({ debug: p, log: p, info: p, warn: p, error: p}))(
7119
- // eslint-disable-next-line no-undef
7120
- wrapLogger(globalThis.print)):
7201
+ // Make a good-enough console for eshost (including only functions that
7202
+ // log at a specific level with no special argument interpretation).
7203
+ // https://console.spec.whatwg.org/#logging
7204
+ ((p)=>freeze({ debug: p, log: p, info: p, warn: p, error: p}))(
7205
+ // eslint-disable-next-line no-undef
7206
+ wrapLogger(globalThis.print)):
7121
7207
 
7122
- undefined;
7208
+ undefined;
7123
7209
 
7124
7210
 
7125
7211
  // Upgrade a log-only console (as in `eshost -h SpiderMonkey`).
@@ -10515,6 +10601,7 @@ globalThis.assert= assert;
10515
10601
  ReferenceError: cell("ReferenceError"),
10516
10602
  SyntaxError: cell("SyntaxError"),
10517
10603
  TypeError: cell("TypeError"),
10604
+ AggregateError: cell("AggregateError"),
10518
10605
  assign: cell("assign"),
10519
10606
  create: cell("create"),
10520
10607
  defineProperties: cell("defineProperties"),
@@ -10659,12 +10746,12 @@ globalThis.assert= assert;
10659
10746
  makeHardener: cell("makeHardener"),
10660
10747
  },
10661
10748
  {
10749
+ NativeErrors: cell("NativeErrors"),
10662
10750
  constantProperties: cell("constantProperties"),
10663
10751
  universalPropertyNames: cell("universalPropertyNames"),
10664
10752
  initialGlobalPropertyNames: cell("initialGlobalPropertyNames"),
10665
10753
  sharedGlobalPropertyNames: cell("sharedGlobalPropertyNames"),
10666
10754
  uniqueGlobalPropertyNames: cell("uniqueGlobalPropertyNames"),
10667
- NativeErrors: cell("NativeErrors"),
10668
10755
  FunctionInstance: cell("FunctionInstance"),
10669
10756
  AsyncFunctionInstance: cell("AsyncFunctionInstance"),
10670
10757
  isAccessorPermit: cell("isAccessorPermit"),
@@ -10884,6 +10971,7 @@ function observeImports(map, importName, importIndex) {
10884
10971
  ReferenceError: cells[0].ReferenceError.set,
10885
10972
  SyntaxError: cells[0].SyntaxError.set,
10886
10973
  TypeError: cells[0].TypeError.set,
10974
+ AggregateError: cells[0].AggregateError.set,
10887
10975
  assign: cells[0].assign.set,
10888
10976
  create: cells[0].create.set,
10889
10977
  defineProperties: cells[0].defineProperties.set,
@@ -11124,16 +11212,17 @@ function observeImports(map, importName, importIndex) {
11124
11212
  functors[11]({
11125
11213
  imports(entries) {
11126
11214
  const map = new Map(entries);
11215
+ observeImports(map, "./commons.js", 0);
11127
11216
  },
11128
11217
  liveVar: {
11129
11218
  },
11130
11219
  onceVar: {
11220
+ NativeErrors: cells[11].NativeErrors.set,
11131
11221
  constantProperties: cells[11].constantProperties.set,
11132
11222
  universalPropertyNames: cells[11].universalPropertyNames.set,
11133
11223
  initialGlobalPropertyNames: cells[11].initialGlobalPropertyNames.set,
11134
11224
  sharedGlobalPropertyNames: cells[11].sharedGlobalPropertyNames.set,
11135
11225
  uniqueGlobalPropertyNames: cells[11].uniqueGlobalPropertyNames.set,
11136
- NativeErrors: cells[11].NativeErrors.set,
11137
11226
  FunctionInstance: cells[11].FunctionInstance.set,
11138
11227
  AsyncFunctionInstance: cells[11].AsyncFunctionInstance.set,
11139
11228
  isAccessorPermit: cells[11].isAccessorPermit.set,