From acde7a3173140260d66ce0ed8d49bec26b562bd9 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Sat, 27 Jan 2024 00:08:36 -0800 Subject: [PATCH] fixup: review suggestions --- packages/captp/src/captp.js | 4 ++-- packages/common/throw-labeled.js | 4 ++-- packages/errors/index.js | 2 +- packages/marshal/src/marshal.js | 4 ++-- packages/marshal/src/types.js | 2 +- packages/pass-style/src/error.js | 4 ++-- packages/patterns/src/patterns/patternMatchers.js | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/captp/src/captp.js b/packages/captp/src/captp.js index 6805d5dd06..db6033b0f8 100644 --- a/packages/captp/src/captp.js +++ b/packages/captp/src/captp.js @@ -12,7 +12,7 @@ import { Remotable, Far, makeMarshal, QCLASS } from '@endo/marshal'; import { E, HandledPromise } from '@endo/eventual-send'; import { isPromise, makePromiseKit } from '@endo/promise-kit'; -import { X, Fail, errorNote } from '@endo/errors'; +import { X, Fail, annotateError } from '@endo/errors'; import { makeTrap } from './trap.js'; import { makeFinalizingMap } from './finalize.js'; @@ -669,7 +669,7 @@ export const makeCapTP = ( if (!e) { Fail`trapGuest expected trapHost AsyncIterator(${questionID}) to be done, but it wasn't`; } - errorNote(e, X`trapHost AsyncIterator(${questionID}) threw`); + annotateError(e, X`trapHost AsyncIterator(${questionID}) threw`); throw e; } }; diff --git a/packages/common/throw-labeled.js b/packages/common/throw-labeled.js index 858476b460..b7457ecf4f 100644 --- a/packages/common/throw-labeled.js +++ b/packages/common/throw-labeled.js @@ -1,4 +1,4 @@ -import { X, makeError, errorNote } from '@endo/errors'; +import { X, makeError, annotateError } from '@endo/errors'; /** * Given an error `innerErr` and a `label`, throws a similar @@ -15,7 +15,7 @@ export const throwLabeled = (innerErr, label, ErrorConstructor = undefined) => { label = `[${label}]`; } const outerErr = makeError(`${label}: ${innerErr.message}`, ErrorConstructor); - errorNote(outerErr, X`Caused by ${innerErr}`); + annotateError(outerErr, X`Caused by ${innerErr}`); throw outerErr; }; harden(throwLabeled); diff --git a/packages/errors/index.js b/packages/errors/index.js index 077f803cf1..15320cbe1e 100644 --- a/packages/errors/index.js +++ b/packages/errors/index.js @@ -76,5 +76,5 @@ export { quote as q, redacted as X, throwRedacted as Fail, - note as errorNote, + note as annotateError, }; diff --git a/packages/marshal/src/marshal.js b/packages/marshal/src/marshal.js index 11213a7536..fe2b419e3b 100644 --- a/packages/marshal/src/marshal.js +++ b/packages/marshal/src/marshal.js @@ -8,7 +8,7 @@ import { hasOwnPropertyOf, } from '@endo/pass-style'; -import { X, Fail, q, makeError, errorNote } from '@endo/errors'; +import { X, Fail, q, makeError, annotateError } from '@endo/errors'; import { QCLASS, makeEncodeToCapData, @@ -124,7 +124,7 @@ export const makeMarshal = ( // with the correlation. const errorId = encodeRecur(nextErrorId()); assert.typeof(errorId, 'string'); - errorNote(err, X`Sent as ${errorId}`); + annotateError(err, X`Sent as ${errorId}`); marshalSaveError(err); return harden({ errorId, message, name }); } else { diff --git a/packages/marshal/src/types.js b/packages/marshal/src/types.js index c80c1a416d..bc4899e1f5 100644 --- a/packages/marshal/src/types.js +++ b/packages/marshal/src/types.js @@ -116,7 +116,7 @@ export {}; * identify the sending of errors relative to this marshal instance. * @property {(err: Error) => void=} marshalSaveError If `errorTagging` is * `'on'`, then errors serialized by this marshal instance are also - * logged by calling `marshalSaveError` *after* `errorNote` associated + * logged by calling `marshalSaveError` *after* `annotateError` associated * that error with its errorId. Thus, if `marshalSaveError` in turn logs * to the normal console, which is the default, then the console will * show that note showing the associated errorId. diff --git a/packages/pass-style/src/error.js b/packages/pass-style/src/error.js index b7798448bd..d015aaac9b 100644 --- a/packages/pass-style/src/error.js +++ b/packages/pass-style/src/error.js @@ -1,6 +1,6 @@ /// -import { X, Fail, errorNote } from '@endo/errors'; +import { X, Fail, annotateError } from '@endo/errors'; import { assertChecker } from './passStyle-helpers.js'; /** @typedef {import('./internal-types.js').PassStyleHelper} PassStyleHelper */ @@ -116,7 +116,7 @@ export const toPassableError = err => { // Even the cleaned up error copy, if sent to the console, should // cause hidden diagnostic information of the original error // to be logged. - errorNote(newError, X`copied from error ${err}`); + annotateError(newError, X`copied from error ${err}`); return newError; }; harden(toPassableError); diff --git a/packages/patterns/src/patterns/patternMatchers.js b/packages/patterns/src/patterns/patternMatchers.js index 2cfb1f3d89..aafeb33413 100644 --- a/packages/patterns/src/patterns/patternMatchers.js +++ b/packages/patterns/src/patterns/patternMatchers.js @@ -18,7 +18,7 @@ import { applyLabelingError } from '@endo/common/apply-labeling-error.js'; import { fromUniqueEntries } from '@endo/common/from-unique-entries.js'; import { listDifference } from '@endo/common/list-difference.js'; -import { q, b, X, Fail, makeError, errorNote } from '@endo/errors'; +import { q, b, X, Fail, makeError, annotateError } from '@endo/errors'; import { keyEQ, keyGT, keyGTE, keyLT, keyLTE } from '../keys/compareKeys.js'; import { assertKey, @@ -590,7 +590,7 @@ const makePatternKit = () => { X`internal: ${label}: inconsistent pattern match: ${q(patt)}`, ); if (innerError !== undefined) { - errorNote(outerError, X`caused by ${innerError}`); + annotateError(outerError, X`caused by ${innerError}`); } throw outerError; };