Skip to content

Commit

Permalink
Catch/tolerate abort errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Jul 31, 2024
1 parent ffe9138 commit 452dbc5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions read.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,11 @@ export function addReadMethods(
let txnPromise;
if (this.isRoot) {
// if it is root, we need to abort and/or wait for transactions to finish
if (readTxn) readTxn.abort();
else readTxn = {};
if (readTxn) {
try {
readTxn.abort();
} catch (error) {}
} else readTxn = {};
readTxn.isDone = true;
Object.defineProperty(readTxn, 'renew', {
value: () => {
Expand All @@ -967,7 +970,9 @@ export function addReadMethods(
);
}
env.address = 0;
env.close();
try {
env.close();
} catch (error) {}
} else this.db.close();
this.status = 'closed';
if (callback) callback();
Expand Down

0 comments on commit 452dbc5

Please sign in to comment.