Skip to content

Commit

Permalink
Replace varint assert with exception (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
extremeheat authored Jun 9, 2024
1 parent 3cb014a commit fcf3ca0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/datatypes/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const assert = require('assert')

const { getCount, sendCount, calcCount, PartialReadError } = require('../utils')

module.exports = {
Expand Down Expand Up @@ -77,7 +75,7 @@ function readVarInt (buffer, offset) {
}
}
shift += 7 // we only have 7 bits, MSB being the return-trigger
assert.ok(shift < 64, 'varint is too big') // Make sure our shift don't overflow.
if (shift > 64) throw new PartialReadError(`varint is too big: ${shift}`) // Make sure our shift don't overflow.
}
}

Expand Down

0 comments on commit fcf3ca0

Please sign in to comment.