Skip to content

Commit

Permalink
errors: make range mandatory in ERR_OUT_OF_RANGE
Browse files Browse the repository at this point in the history
So far the range argument was allowed to be undefined. This is not
used in the codebase anymore and therefore it is best to make it
mandatory for the best user experience.

PR-URL: #26924
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
BridgeAR authored and targos committed Mar 30, 2019
1 parent 682b410 commit c756b84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -933,10 +933,10 @@ E('ERR_NO_ICU',
E('ERR_NO_LONGER_SUPPORTED', '%s is no longer supported', Error);
E('ERR_OUT_OF_RANGE',
(str, range, input, replaceDefaultBoolean = false) => {
assert(range, 'Missing "range" argument');
let msg = replaceDefaultBoolean ? str :
`The value of "${str}" is out of range.`;
if (range !== undefined) msg += ` It must be ${range}.`;
msg += ` Received ${input}`;
msg += ` It must be ${range}. Received ${input}`;
return msg;
}, RangeError);
E('ERR_REQUIRE_ESM', 'Must use import to load ES Module: %s', Error);
Expand Down

0 comments on commit c756b84

Please sign in to comment.