diff --git a/index.js b/index.js index fd216feb..7743b597 100644 --- a/index.js +++ b/index.js @@ -949,7 +949,7 @@ class Batch { } destroy () { // compat, remove later - this.close().catch(noop) + this.close().catch(safetyCatch) } toBlocks () { @@ -1391,7 +1391,7 @@ function iteratorToStream (ite, signal) { }, predestroy () { closing = ite.close() - closing.catch(noop) + closing.catch(safetyCatch) }, destroy (cb) { done = cb diff --git a/lib/extension.js b/lib/extension.js index dab0d831..d1c87ae5 100644 --- a/lib/extension.js +++ b/lib/extension.js @@ -1,3 +1,4 @@ +const safetyCatch = require('safety-catch') const { Extension } = require('./messages') // const MAX_ACTIVE = 32 @@ -80,7 +81,7 @@ class HyperbeeExtension { db.get(message.key, { extension: false, wait: false, update: false, onseq }).then(done, done) function done () { - db.close().catch(noop) + db.close().catch(safetyCatch) b.send() } @@ -120,7 +121,7 @@ class HyperbeeExtension { } catch (_) { // do nothing } finally { - db.close().catch(noop) + db.close().catch(safetyCatch) b.send() } } @@ -143,5 +144,3 @@ function decode (buf) { return null } } - -function noop () {}