Skip to content

Commit

Permalink
throw decoding error
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapaezbas committed Sep 6, 2024
1 parent 88a1a2f commit a97c4dd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const {
BAD_ARGUMENT,
SESSION_CLOSED,
SESSION_NOT_WRITABLE,
SNAPSHOT_NOT_AVAILABLE
SNAPSHOT_NOT_AVAILABLE,
DECODING_ERROR
} = require('hypercore-errors')

const promises = Symbol.for('hypercore.promises')
Expand Down Expand Up @@ -862,7 +863,11 @@ module.exports = class Hypercore extends EventEmitter {
this.encryption.decrypt(index, block)
}

return this._decode(encoding, block)
try {
return this._decode(encoding, block)
} catch {
throw DECODING_ERROR()
}
}

async clear (start, end = start + 1, opts) {
Expand Down

0 comments on commit a97c4dd

Please sign in to comment.