Skip to content

Commit e153153

Browse files
committed
Throw Error instead of string
1 parent 5f18e2d commit e153153

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

KaitaiStream.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ KaitaiStream.prototype.readBytesTerm = function(terminator, include, consume, eo
519519
if (i < 0) {
520520
// we've read all the buffer and haven't found the terminator
521521
if (eosError) {
522-
throw "End of stream reached, but no terminator " + terminator + " found";
522+
throw new Error("End of stream reached, but no terminator " + terminator + " found");
523523
}
524524
return this.readBytes(len);
525525
}
@@ -623,7 +623,7 @@ KaitaiStream.processXorMany = function(data, key) {
623623

624624
KaitaiStream.processRotateLeft = function(data, amount, groupSize) {
625625
if (groupSize !== 1)
626-
throw("unable to rotate group of " + groupSize + " bytes yet");
626+
throw new Error("unable to rotate group of " + groupSize + " bytes yet");
627627

628628
var mask = groupSize * 8 - 1;
629629
var antiAmount = -amount & mask;
@@ -666,7 +666,7 @@ KaitaiStream.processZlib = function(buf) {
666666

667667
KaitaiStream.mod = function(a, b) {
668668
if (b <= 0)
669-
throw "mod divisor <= 0";
669+
throw new Error("mod divisor <= 0");
670670
var r = a % b;
671671
if (r < 0)
672672
r += b;

0 commit comments

Comments
 (0)