Skip to content

Commit 6eb008d

Browse files
committed
Throw Error instead of string
1 parent 31751f8 commit 6eb008d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

KaitaiStream.js

+3-3
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
}
@@ -621,7 +621,7 @@ KaitaiStream.processXorMany = function(data, key) {
621621

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

626626
var mask = groupSize * 8 - 1;
627627
var antiAmount = -amount & mask;
@@ -664,7 +664,7 @@ KaitaiStream.processZlib = function(buf) {
664664

665665
KaitaiStream.mod = function(a, b) {
666666
if (b <= 0)
667-
throw "mod divisor <= 0";
667+
throw new Error("mod divisor <= 0");
668668
var r = a % b;
669669
if (r < 0)
670670
r += b;

0 commit comments

Comments
 (0)