From 9e63e754ae7507db996ec77d731698e07ca7fb1e Mon Sep 17 00:00:00 2001 From: Sebastien La Duca Date: Sun, 19 Nov 2023 12:13:57 -0500 Subject: [PATCH] warn instead of throwing on record not found (#624) * warn instead of throwing on record not found * warn instead of throwing when setting status of non-existent op * changeset --- .changeset/cuddly-turkeys-prove.md | 6 ++++++ packages/client/src/NocturneDB.ts | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changeset/cuddly-turkeys-prove.md diff --git a/.changeset/cuddly-turkeys-prove.md b/.changeset/cuddly-turkeys-prove.md new file mode 100644 index 000000000..e547a1bc4 --- /dev/null +++ b/.changeset/cuddly-turkeys-prove.md @@ -0,0 +1,6 @@ +--- +"@nocturne-xyz/frontend-sdk": patch +"@nocturne-xyz/client": patch +--- + +log instead of throw on missing op history record diff --git a/packages/client/src/NocturneDB.ts b/packages/client/src/NocturneDB.ts index aaf5d4f86..7ad1a92c1 100644 --- a/packages/client/src/NocturneDB.ts +++ b/packages/client/src/NocturneDB.ts @@ -167,7 +167,7 @@ export class NocturneDB { // if any record is missing, something bad happened if (records.some((r) => r === undefined)) { - throw new Error("record not found"); + console.error("missing record in history"); } if (!includePending) { @@ -193,7 +193,10 @@ export class NocturneDB { await this.mutex.runExclusive(async () => { const record = await this._getHistoryRecord(opDigest); if (record === undefined) { - throw new Error("record not found"); + console.warn( + "attempting to set status of op whose record has been pruned" + ); + return; } record.status = status;