Skip to content

Commit

Permalink
fix(leb128): change error message
Browse files Browse the repository at this point in the history
  • Loading branch information
xtuc committed Apr 6, 2018
1 parent 5f49e87 commit a348ea6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/leb128/src/leb.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function encodedLength(encodedBuffer, index) {
result++; // to account for the last byte

if (index + result > encodedBuffer.length) {
throw new Error("Bogus encoding");
throw new Error("integer representation too long");
}

return result;
Expand Down Expand Up @@ -220,7 +220,7 @@ function decodeInt32(encodedBuffer, index) {
bufs.free(result.value);

if (value < MIN_INT32 || value > MAX_INT32) {
throw new Error("Result out of range");
throw new Error("integer too large");
}

return { value: value, nextIndex: result.nextIndex };
Expand Down Expand Up @@ -282,7 +282,7 @@ function decodeUInt32(encodedBuffer, index) {
bufs.free(result.value);

if (value > MAX_UINT32) {
throw new Error("Result out of range");
throw new Error("integer too large");
}

return { value: value, nextIndex: result.nextIndex };
Expand All @@ -307,7 +307,7 @@ function decodeUInt64(encodedBuffer, index) {
bufs.free(result.value);

if (value > MAX_UINT64) {
throw new Error("Result out of range");
throw new Error("integer too large");
}

return { value: value, nextIndex: result.nextIndex, lossy: parsed.lossy };
Expand Down

0 comments on commit a348ea6

Please sign in to comment.