Skip to content

Commit

Permalink
squash! check windowsBits === 8 early
Browse files Browse the repository at this point in the history
  • Loading branch information
aqrln committed May 18, 2017
1 parent c5f18b1 commit bf63a37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ class Zlib extends Transform {
opts.windowBits > constants.Z_MAX_WINDOWBITS) {
throw new RangeError('Invalid windowBits: ' + opts.windowBits);
}
if (mode === constants.DEFLATERAW &&

This comment has been minimized.

Copy link
@lpinca

lpinca May 18, 2017

Why not merging this with the previous if and use the existing error?

This comment has been minimized.

Copy link
@aqrln

aqrln May 19, 2017

Author Owner

@lpinca yeah, that was my first thought too, but I decided to draw the line between the values that aren't valid per se and the value that's actually pretty valid, just not supported by zlib at the moment.

opts.windowBits === 8) {
throw new RangeError('Unsupported windowBits for DeflateRaw: 8');
}
}

if (opts.level) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ const zlib = require('zlib');
// (http://zlib.net/manual.html#Advanced)
assert.throws(() => {
zlib.createDeflateRaw({ windowBits: 8 });
}, /^Error: Init error$/);
}, /^RangeError: Unsupported windowBits for DeflateRaw: 8$/);

0 comments on commit bf63a37

Please sign in to comment.