Skip to content

Commit 43c73d1

Browse files
committed
Throw Error instead of string
1 parent 661246e commit 43c73d1

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
@@ -559,7 +559,7 @@ KaitaiStream.prototype.readBytesTerm = function(terminator, include, consume, eo
559559
if (i < 0) {
560560
// we've read all the buffer and haven't found the terminator
561561
if (eosError) {
562-
throw "End of stream reached, but no terminator " + terminator + " found";
562+
throw new Error("End of stream reached, but no terminator " + terminator + " found");
563563
}
564564
return this.readBytes(len);
565565
}
@@ -663,7 +663,7 @@ KaitaiStream.processXorMany = function(data, key) {
663663

664664
KaitaiStream.processRotateLeft = function(data, amount, groupSize) {
665665
if (groupSize !== 1)
666-
throw("unable to rotate group of " + groupSize + " bytes yet");
666+
throw new Error("unable to rotate group of " + groupSize + " bytes yet");
667667

668668
var mask = groupSize * 8 - 1;
669669
var antiAmount = -amount & mask;
@@ -706,7 +706,7 @@ KaitaiStream.processZlib = function(buf) {
706706

707707
KaitaiStream.mod = function(a, b) {
708708
if (b <= 0)
709-
throw "mod divisor <= 0";
709+
throw new Error("mod divisor <= 0");
710710
var r = a % b;
711711
if (r < 0)
712712
r += b;

0 commit comments

Comments
 (0)