Commit bf5a85b
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 bf5a85bCopy full SHA for bf5a85b
File tree
Expand file treeCollapse file tree
2 files changed
+6
-3
lines changedOpen diff view settings
Filter options
- lib/internal/crypto
- test/parallel
Expand file treeCollapse file tree
2 files changed
+6
-3
lines changedOpen diff view settings
Collapse file
lib/internal/crypto/random.js
Copy file name to clipboardExpand all lines: lib/internal/crypto/random.js+3-1Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | | - |
| 153 | + |
| 154 | + |
| 155 | + |
154 | 156 | |
155 | 157 | |
156 | 158 | |
|
Collapse file
test/parallel/test-crypto-random.js
Copy file name to clipboardExpand all lines: test/parallel/test-crypto-random.js+3-2Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
462 | 462 | |
463 | 463 | |
464 | 464 | |
465 | | - |
466 | | - |
| 465 | + |
| 466 | + |
| 467 | + |
467 | 468 | |
468 | 469 | |
469 | 470 | |
|
0 commit comments