Skip to content
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

Closed

Conversation

seppevs
Copy link
Contributor

@seppevs seppevs commented Feb 10, 2017

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), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

errors,net

@nodejs-github-bot nodejs-github-bot added errors Issues and PRs related to JavaScript errors originated in Node.js core. net Issues and PRs related to the net subsystem. labels Feb 10, 2017
@seppevs seppevs force-pushed the internal_net_use_internal_error branch from 6f56724 to 3cd2f1e Compare February 10, 2017 21:35
@@ -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');
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joyeecheung : Fixed

@seppevs seppevs force-pushed the internal_net_use_internal_error branch from 3cd2f1e to 28c2ee2 Compare February 11, 2017 14:34
Copy link
Member

@jasnell jasnell left a 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

@@ -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}"`;
Copy link
Member

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

Copy link
Contributor Author

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

@seppevs seppevs force-pushed the internal_net_use_internal_error branch from 28c2ee2 to d2c3e7e Compare February 11, 2017 18:30
@@ -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}"`;
Copy link
Member

@joyeecheung joyeecheung Feb 12, 2017

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.

Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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
Copy link
Contributor

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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?

Copy link
Member

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.

Copy link
Contributor

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.

@joyeecheung joyeecheung added the semver-major PRs that contain breaking changes and should be released in the next major version. label Feb 14, 2017
@joyeecheung
Copy link
Member

@jasnell jasnell added the blocked PRs that are blocked by other issues or PRs. label Apr 5, 2017
@jasnell
Copy link
Member

jasnell commented May 1, 2017

We're finally able to move forward on this, but it's going to need a rebase

@seppevs
Copy link
Contributor Author

seppevs commented May 1, 2017

I don't think this PR is still necessary: I see no Error messages in internal/net.js anymore.
Can you confirm, @jasnell ?

@jasnell
Copy link
Member

jasnell commented May 1, 2017

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.

@fhinkel
Copy link
Member

fhinkel commented May 23, 2017

@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.

@fhinkel fhinkel closed this May 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked PRs that are blocked by other issues or PRs. errors Issues and PRs related to JavaScript errors originated in Node.js core. net Issues and PRs related to the net subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants