-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: check codes of thrown errors #23519
test: check codes of thrown errors #23519
Conversation
test/parallel/test-buffer-alloc.js
Outdated
assert.throws(() => Buffer.alloc(8).writeFloatLE(0, 5), RangeError); | ||
assert.throws(() => Buffer.alloc(16).writeDoubleLE(0, 9), RangeError); | ||
assert.throws(() => Buffer.alloc(8).writeFloatLE(0, 5), { | ||
code: 'ERR_OUT_OF_RANGE', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The object can be moved to a function, for example:
const getRangeError = (min, max, received) => ({
code: 'ERR_OUT_OF_RANGE',
name: 'RangeError [ERR_OUT_OF_RANGE]',
message: `The value of "offset" is out of range. It must be >= ${min} ` +
'and <= ${max}. Received ${received}'
});
And reused across the file
Uh … @Trott what do we do here? I think this conflicts quite a bit with your PR in https://github.com/nodejs/node/pull/23645… |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
This needs a rebase, unfortunately, and I don’t know how tricky that gets…
be1f9c6
to
f1e4160
Compare
I rebased and force pushed to resolve the merge conflict. New CI: https://ci.nodejs.org/job/node-test-pull-request/17923/ |
PR-URL: nodejs#23519 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: George Adams <george.adams@uk.ibm.com>
Landed in c208135 |
PR-URL: #23519 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: George Adams <george.adams@uk.ibm.com>
PR-URL: #23519 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: George Adams <george.adams@uk.ibm.com>
PR-URL: #23519 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: George Adams <george.adams@uk.ibm.com>
PR-URL: #23519 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: George Adams <george.adams@uk.ibm.com>
PR-URL: #23519 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: George Adams <george.adams@uk.ibm.com>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes