Skip to content

Commit

Permalink
warn instead of throwing on record not found (#624)
Browse files Browse the repository at this point in the history
* warn instead of throwing on record not found

* warn instead of throwing when setting status of non-existent op

* changeset
  • Loading branch information
Sladuca authored Nov 19, 2023
1 parent 326fd2b commit 9e63e75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/cuddly-turkeys-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@nocturne-xyz/frontend-sdk": patch
"@nocturne-xyz/client": patch
---

log instead of throw on missing op history record
7 changes: 5 additions & 2 deletions packages/client/src/NocturneDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 9e63e75

Please sign in to comment.