lib: combine similar error codes

There two similar error codes in lib: "ERR_VALUE_OUT_OF_RANGE"
and "ERR_OUT_OF_RANGE". This change is to reduce them into
"ERR_VALUE_OUT_OF_RANGE"

Fixes: https://github.com/nodejs/node/issues/17603

PR-URL: https://github.com/nodejs/node/pull/17648
Fixes: https://github.com/nodejs/node/issues/17603
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Weijia Wang 2017-12-13 20:48:43 +08:00
parent 4d74b52979
commit d022cb1bdd
17 changed files with 70 additions and 42 deletions

View file

@ -650,7 +650,7 @@ exports.execSync = execSync;
function validateTimeout(timeout) {
if (timeout != null && !(Number.isInteger(timeout) && timeout >= 0)) {
throw new errors.RangeError('ERR_VALUE_OUT_OF_RANGE',
throw new errors.RangeError('ERR_OUT_OF_RANGE',
'timeout',
'an unsigned integer',
timeout);
@ -660,7 +660,7 @@ function validateTimeout(timeout) {
function validateMaxBuffer(maxBuffer) {
if (maxBuffer != null && !(typeof maxBuffer === 'number' && maxBuffer >= 0)) {
throw new errors.RangeError('ERR_VALUE_OUT_OF_RANGE',
throw new errors.RangeError('ERR_OUT_OF_RANGE',
'options.maxBuffer',
'a positive number',
maxBuffer);