-
Notifications
You must be signed in to change notification settings - Fork 30k
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
internal/util: use internal/errors.js #11301
Conversation
42ca4c3
to
0cb54ec
Compare
assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', ['b', 'c']]), | ||
'The "a" argument must be one of type b, or c'); | ||
assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', | ||
['a', ['b', 'c', 'd']]), |
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.
nit: indentation looks off here?
assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', 'b', 'c']), | ||
'The "a" argument must be type b. Received type string'); | ||
assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', | ||
['a', 'b', undefined]), |
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.
ditto
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.
@joyeecheung: the indentation is suggested by the linter
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.
Hmm, looks like the linter is OK with arguments not indented the same way, as long as it's indented? Anyway it doesn't need to be fixed, just a nit :D
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.
No, the linter expects the identation to start at an exact position: the position where the parameters start on the previous line.
lib/internal/errors.js
Outdated
// Add new errors from here... | ||
|
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.
I think this function should go to the top.
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.
We're finally able to move forward on this, but it's going to need a rebase |
0cb54ec
to
70f3091
Compare
Rebase done |
@nodejs/ctc ... this is ready to go, but as a semver-major needs another CTC member to sign off |
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.
LGTM modulo textual nits and assuming CI is green.
doc/api/errors.md
Outdated
|
||
An error using the `'ERR_NO_CRYPTO'` error code is thrown specifically when | ||
an attempt is made to use crypto features while Node.js is not compiled | ||
with OpenSSL crypto support |
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.
Nit: Please put a period at the end of the sentence.
lib/internal/errors.js
Outdated
@@ -111,6 +111,7 @@ E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected'); | |||
E('ERR_IPC_ONE_PIPE', 'Child process can have only one IPC pipe'); | |||
E('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks'); | |||
E('ERR_MISSING_ARGS', missingArgs); | |||
E('ERR_NO_CRYPTO', 'Node.js is not compiled with openssl crypto support'); |
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.
Nit: openssl
-> OpenSSL
Changes done |
70f3091
to
498b4b3
Compare
@jasnell Should the |
const assert = require('assert'); | ||
const util = require('internal/util'); | ||
|
||
const expectedError = common.expectsError('ERR_NO_CRYPTO', Error); |
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.
this should use the object param... e.g.
common.expectsError({
code: 'ERR_NO_CRYPTO',
type: Error
});
@seppevs Please fix @jasnell's annotation (#11301 (comment)) and resolve the conflicts. |
doc/api/errors.md
Outdated
<a id="ERR_NO_CRYPTO"></a> | ||
### ERR_NO_CRYPTO | ||
|
||
An error using the `'ERR_NO_CRYPTO'` error code is thrown specifically when |
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.
Please adapt this to match the wording used in #13627 ("Used when an attempt is made...").
Changes done |
498b4b3
to
812fb50
Compare
doc/api/errors.md
Outdated
<a id="ERR_NO_CRYPTO"></a> | ||
### ERR_NO_CRYPTO | ||
|
||
Used when an attempt is made to use crypto features while Node.js is not compiled |
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.
Nit: This should be wrapped at 80 characters. I will approve and start CI after this is fixed.
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.
Fixed
812fb50
to
efddcf1
Compare
Landed in de4a749, thank you! 🎉 |
PR-URL: #11301 Refs: #11273 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
Change internal/util.js so it makes use of the new internal/errors.js module.
See #11273 for more info.
cc @jasnell
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
error