crypto: improve randomInt out-of-range error message · nodejs/node@bf5a85b · GitHub
Skip to content

Commit bf5a85b

Browse files
Trottaddaleax
authored andcommitted
crypto: improve randomInt out-of-range error message
Previously, the crypto.randomInt() message when "max" was less than or equal to "min" made it sound like the lower bound for "max" was hard-coded. Make it clear that it is instead dynamic based on the value of "min". For crypto.randomInt(10,0): Before: RangeError [ERR_OUT_OF_RANGE]: The value of "max" is out of range. It must be > 10. Received 0 After: RangeError [ERR_OUT_OF_RANGE]: The value of "max" is out of range. It must be greater than the value of "min" (10). Received 0 PR-URL: #35088 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 5ef9ee4 commit bf5a85b

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/internal/crypto/random.js

Lines changed: 3 additions & 1 deletion

test/parallel/test-crypto-random.js

Lines changed: 3 additions & 2 deletions

0 commit comments

Comments
 (0)