hypercore 10.37.19 → 10.37.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -26,7 +26,8 @@ const {
|
|
|
26
26
|
BAD_ARGUMENT,
|
|
27
27
|
SESSION_CLOSED,
|
|
28
28
|
SESSION_NOT_WRITABLE,
|
|
29
|
-
SNAPSHOT_NOT_AVAILABLE
|
|
29
|
+
SNAPSHOT_NOT_AVAILABLE,
|
|
30
|
+
DECODING_ERROR
|
|
30
31
|
} = require('hypercore-errors')
|
|
31
32
|
|
|
32
33
|
const promises = Symbol.for('hypercore.promises')
|
|
@@ -1108,7 +1109,11 @@ module.exports = class Hypercore extends EventEmitter {
|
|
|
1108
1109
|
|
|
1109
1110
|
_decode (enc, block) {
|
|
1110
1111
|
if (this.padding) block = block.subarray(this.padding)
|
|
1111
|
-
|
|
1112
|
+
try {
|
|
1113
|
+
if (enc) return c.decode(enc, block)
|
|
1114
|
+
} catch {
|
|
1115
|
+
throw DECODING_ERROR()
|
|
1116
|
+
}
|
|
1112
1117
|
return block
|
|
1113
1118
|
}
|
|
1114
1119
|
}
|