@agoric/vow 0.1.1-dev-0752cec.0 → 0.1.1-dev-940d3f0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/vow",
3
- "version": "0.1.1-dev-0752cec.0+0752cec",
3
+ "version": "0.1.1-dev-940d3f0.0+940d3f0",
4
4
  "description": "Remote (shortening and disconnection-tolerant) Promise-likes",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -20,9 +20,10 @@
20
20
  "lint:types": "tsc"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/base-zone": "0.1.1-dev-0752cec.0+0752cec",
24
- "@agoric/internal": "0.3.3-dev-0752cec.0+0752cec",
23
+ "@agoric/base-zone": "0.1.1-dev-940d3f0.0+940d3f0",
24
+ "@agoric/internal": "0.3.3-dev-940d3f0.0+940d3f0",
25
25
  "@endo/env-options": "^1.1.4",
26
+ "@endo/errors": "^1.2.2",
26
27
  "@endo/eventual-send": "^1.2.2",
27
28
  "@endo/pass-style": "^1.4.0",
28
29
  "@endo/patterns": "^1.4.0",
@@ -54,5 +55,5 @@
54
55
  "typeCoverage": {
55
56
  "atLeast": 89.6
56
57
  },
57
- "gitHead": "0752cecf484c94c1f596dcf7cb8ffd8429a8381c"
58
+ "gitHead": "940d3f0a993ca45a6bb0893bd59e6df1f22d9143"
58
59
  }
package/src/E.js CHANGED
@@ -15,10 +15,10 @@
15
15
  * designed to be a drop-in replacement for the version in
16
16
  * `@endo/eventual-send/src/E.js` which contained no concept of "unwrap",
17
17
  */
18
+ import { X, q, Fail, makeError } from '@endo/errors';
18
19
  import { trackTurns } from './track-turns.js';
19
20
  import { makeMessageBreakpointTester } from './message-breakpoints.js';
20
21
 
21
- const { details: X, quote: q, Fail } = assert;
22
22
  const { assign, create } = Object;
23
23
 
24
24
  const onSend = makeMessageBreakpointTester('ENDO_SEND_BREAKPOINTS');
@@ -79,7 +79,7 @@ const makeEProxyHandler = (recipient, HandledPromise, unwrap) =>
79
79
  if (this !== receiver) {
80
80
  // Reject the async function call
81
81
  return HandledPromise.reject(
82
- assert.error(
82
+ makeError(
83
83
  X`Unexpected receiver for "${q(propertyKey)}" method of E(${q(
84
84
  recipient,
85
85
  )})`,
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
2
  import { getEnvironmentOption } from '@endo/env-options';
3
3
 
4
- const { quote: q, Fail } = assert;
4
+ import { q, Fail } from '@endo/errors';
5
5
 
6
6
  const { hasOwn, freeze, entries } = Object;
7
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"track-turns.d.ts","sourceRoot":"","sources":["track-turns.js"],"names":[],"mappings":"AAyFO,2BAJwB,CAAC,SAAlB,aAAa,EAAG,SACnB,CAAC,GACC,CAAC,CAmBb;;;;;4BAMY,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,GAAG,SAAS"}
1
+ {"version":3,"file":"track-turns.d.ts","sourceRoot":"","sources":["track-turns.js"],"names":[],"mappings":"AA2FO,2BAJwB,CAAC,SAAlB,aAAa,EAAG,SACnB,CAAC,GACC,CAAC,CAkBb;;;;;4BAMY,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,GAAG,SAAS"}
@@ -5,8 +5,10 @@ import {
5
5
  environmentOptionsListHas,
6
6
  } from '@endo/env-options';
7
7
 
8
- // NOTE: We can't import these because they're not in scope before lockdown.
9
- // import { assert, details as X, Fail } from '@agoric/assert';
8
+ // Note that in the original track-turns.js in @endo/eventual-send we
9
+ // can't simply import these because `assert` is not in scope before lockdown.
10
+ // But this copy in @agoric/vow the import is fine.
11
+ import { annotateError, X } from '@endo/errors';
10
12
 
11
13
  // WARNING: Global Mutable State!
12
14
  // This state is communicated to `assert` that makes it available to the
@@ -34,7 +36,7 @@ const ENABLED =
34
36
 
35
37
  const addRejectionNote = detailsNote => reason => {
36
38
  if (reason instanceof Error) {
37
- assert.note(reason, detailsNote);
39
+ annotateError(reason, detailsNote);
38
40
  }
39
41
  if (VERBOSE) {
40
42
  console.log('REJECTED at top of event loop', reason);
@@ -42,7 +44,7 @@ const addRejectionNote = detailsNote => reason => {
42
44
  };
43
45
 
44
46
  const wrapFunction =
45
- (func, sendingError, X) =>
47
+ (func, sendingError) =>
46
48
  (...args) => {
47
49
  hiddenPriorError = sendingError;
48
50
  hiddenCurrentTurn += 1;
@@ -53,7 +55,7 @@ const wrapFunction =
53
55
  result = func(...args);
54
56
  } catch (err) {
55
57
  if (err instanceof Error) {
56
- assert.note(
58
+ annotateError(
57
59
  err,
58
60
  X`Thrown from: ${hiddenPriorError}:${hiddenCurrentTurn}.${hiddenCurrentEvent}`,
59
61
  );
@@ -91,18 +93,17 @@ export const trackTurns = funcs => {
91
93
  if (!ENABLED || typeof globalThis === 'undefined' || !globalThis.assert) {
92
94
  return funcs;
93
95
  }
94
- const { details: X } = assert;
95
96
 
96
97
  hiddenCurrentEvent += 1;
97
98
  const sendingError = Error(
98
99
  `Event: ${hiddenCurrentTurn}.${hiddenCurrentEvent}`,
99
100
  );
100
101
  if (hiddenPriorError !== undefined) {
101
- assert.note(sendingError, X`Caused by: ${hiddenPriorError}`);
102
+ annotateError(sendingError, X`Caused by: ${hiddenPriorError}`);
102
103
  }
103
104
 
104
105
  return /** @type {T} */ (
105
- funcs.map(func => func && wrapFunction(func, sendingError, X))
106
+ funcs.map(func => func && wrapFunction(func, sendingError))
106
107
  );
107
108
  };
108
109