-
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
errors,net: change internal/net.js to use internal/errors.js #11302
Conversation
6f56724
to
3cd2f1e
Compare
lib/internal/errors.js
Outdated
@@ -86,3 +86,4 @@ module.exports = exports = { | |||
// Note: Please try to keep these in alphabetical order | |||
E('ERR_ASSERTION', (msg) => msg); | |||
// Add new errors from here... | |||
E('ERR_INVALID_PORT', 'Port should be >= 0 and < 65536'); |
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: why not keep the the "port" argument
part?
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 : Fixed
3cd2f1e
to
28c2ee2
Compare
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 with a minor nit
lib/internal/errors.js
Outdated
@@ -86,3 +86,6 @@ module.exports = exports = { | |||
// Note: Please try to keep these in alphabetical order | |||
E('ERR_ASSERTION', (msg) => msg); | |||
// Add new errors from here... | |||
E('ERR_INVALID_PORT', (port) => { | |||
return `Port should be >= 0 and < 65536, got "${port}"`; |
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.
While we're changing this, we should make this say must
instead of should
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.
Done: I've changed should
to must
28c2ee2
to
d2c3e7e
Compare
@@ -86,3 +86,6 @@ module.exports = exports = { | |||
// Note: Please try to keep these in alphabetical order | |||
E('ERR_ASSERTION', (msg) => msg); | |||
// Add new errors from here... | |||
E('ERR_INVALID_PORT', (port) => { | |||
return `Port must be >= 0 and < 65536, got "${port}"`; |
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: the block is unnecessary, we can just
(port) => `"port" argument must be >= 0 and < 65536, got ${port}`
EDIT: no need for the quotes around ${port}
, that looks like a string but usually it's meant to be a number.
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'd prefer the quotes in the case it is not a number.
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.
So should I keep the quotes?
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 am fine with keeping the quotes.
@@ -575,6 +586,7 @@ found [here][online]. | |||
[domains]: domain.html | |||
[event emitter-based]: events.html#events_class_eventemitter | |||
[file descriptors]: https://en.wikipedia.org/wiki/File_descriptor | |||
[Node.js Error Codes]: #nodejs-error-codes |
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 it will be #nodejs_error_codes
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.
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.
@jasnell Yes, I realized it after a while. Shouldn't we let the tools take care of deciding the ids?
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've done it this way to ensure that the ID's remain constant even if the automatic link generation changes or the structure of the document is refactored. I much prefer the explicit headers.
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.
Hmmm, I am not sure. We lose consistency here.
We're finally able to move forward on this, but it's going to need a rebase |
I don't think this PR is still necessary: I see no Error messages in |
It's possible that things were shifted around since then. Errors still need to be migrated but this particular PR may be too out of date to simply rebase. |
@seppevs, thanks for your PR. Sorry that it got dragged out for so long due to being a semver-major change. I'll go ahead and close this. Ping me if it should stay open. |
Change internal/net.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)
errors,net