| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bfadee5 commit 88d71dc
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,6 @@ | |||
| 3 | 3 | const { | |
| 4 | 4 | MapPrototypeEntries, | |
| 5 | 5 | NumberIsNaN, | |
| 6 | - NumberIsInteger, | ||
| 7 | 6 | NumberMAX_SAFE_INTEGER, | |
| 8 | 7 | ObjectFromEntries, | |
| 9 | 8 | ReflectConstruct, | |
@@ -186,9 +185,8 @@ class Histogram { | |||
| 186 | 185 | if (!isHistogram(this)) | |
| 187 | 186 | throw new ERR_INVALID_THIS('Histogram'); | |
| 188 | 187 | validateNumber(percentile, 'percentile'); | |
| 189 | - | ||
| 190 | 188 | if (NumberIsNaN(percentile) || percentile <= 0 || percentile > 100) | |
| 191 | - throw new ERR_INVALID_ARG_VALUE.RangeError('percentile', percentile); | ||
| 189 | + throw new ERR_OUT_OF_RANGE('percentile', '> 0 && <= 100', percentile); | ||
| 192 | 190 | ||
| 193 | 191 | return this[kHandle]?.percentile(percentile); | |
| 194 | 192 | } | |
@@ -201,9 +199,8 @@ class Histogram { | |||
| 201 | 199 | if (!isHistogram(this)) | |
| 202 | 200 | throw new ERR_INVALID_THIS('Histogram'); | |
| 203 | 201 | validateNumber(percentile, 'percentile'); | |
| 204 | - | ||
| 205 | 202 | if (NumberIsNaN(percentile) || percentile <= 0 || percentile > 100) | |
| 206 | - throw new ERR_INVALID_ARG_VALUE.RangeError('percentile', percentile); | ||
| 203 | + throw new ERR_OUT_OF_RANGE('percentile', '> 0 && <= 100', percentile); | ||
| 207 | 204 | ||
| 208 | 205 | return this[kHandle]?.percentileBigInt(percentile); | |
| 209 | 206 | } | |
@@ -283,11 +280,7 @@ class RecordableHistogram extends Histogram { | |||
| 283 | 280 | return; | |
| 284 | 281 | } | |
| 285 | 282 | ||
| 286 | - if (!NumberIsInteger(val)) | ||
| 287 | - throw new ERR_INVALID_ARG_TYPE('val', ['integer', 'bigint'], val); | ||
| 288 | - | ||
| 289 | - if (val < 1 || val > NumberMAX_SAFE_INTEGER) | ||
| 290 | - throw new ERR_OUT_OF_RANGE('val', 'a safe integer greater than 0', val); | ||
| 283 | + validateInteger(val, 'val', 1); | ||
| 291 | 284 | ||
| 292 | 285 | this[kHandle]?.record(val); | |
| 293 | 286 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -91,7 +91,7 @@ const { sleep } = require('internal/util'); | |||
| 91 | 91 | () => histogram.percentile(i), | |
| 92 | 92 | { | |
| 93 | 93 | name: 'RangeError', | |
| 94 | - code: 'ERR_INVALID_ARG_VALUE' | ||
| 94 | + code: 'ERR_OUT_OF_RANGE' | ||
| 95 | 95 | } | |
| 96 | 96 | ); | |
| 97 | 97 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments