Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace noop by safetyCatch where appropriate #142

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ class Batch {
}

destroy () { // compat, remove later
this.close().catch(noop)
this.close().catch(safetyCatch)
}

toBlocks () {
Expand Down Expand Up @@ -1391,7 +1391,7 @@ function iteratorToStream (ite, signal) {
},
predestroy () {
closing = ite.close()
closing.catch(noop)
closing.catch(safetyCatch)
},
destroy (cb) {
done = cb
Expand Down
7 changes: 3 additions & 4 deletions lib/extension.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const safetyCatch = require('safety-catch')
const { Extension } = require('./messages')

// const MAX_ACTIVE = 32
Expand Down Expand Up @@ -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()
}

Expand Down Expand Up @@ -120,7 +121,7 @@ class HyperbeeExtension {
} catch (_) {
// do nothing
} finally {
db.close().catch(noop)
db.close().catch(safetyCatch)
b.send()
}
}
Expand All @@ -143,5 +144,3 @@ function decode (buf) {
return null
}
}

function noop () {}