Skip to content

errors,net: change internal/net.js to use internal/errors.js - #11302

Closed
seppevs wants to merge 1 commit into
nodejs:masterfrom
seppevs:internal_net_use_internal_error
Closed

errors,net: change internal/net.js to use internal/errors.js#11302
seppevs wants to merge 1 commit into
nodejs:masterfrom
seppevs:internal_net_use_internal_error

Conversation

@seppevs

Copy link
Copy Markdown
Contributor

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-botnodejs-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
seppevsforce-pushed the internal_net_use_internal_error branch from 6f56724 to 3cd2f1eCompareFebruary 10, 2017 21:35
Comment threadlib/internal/errors.js Outdated

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@joyeecheung : Fixed

@seppevs
seppevsforce-pushed the internal_net_use_internal_error branch from 3cd2f1e to 28c2ee2CompareFebruary 11, 2017 14:34

@jasnelljasnell left a comment

Copy link
Copy Markdown
Member

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

Comment threadlib/internal/errors.js Outdated

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
seppevsforce-pushed the internal_net_use_internal_error branch from 28c2ee2 to d2c3e7eCompareFebruary 11, 2017 18:30
E('ERR_ASSERTION', (msg) => msg);
// Add new errors from here...
E('ERR_INVALID_PORT', (port) => {
return `Port must be >= 0 and < 65536, got "${port}"`;

@joyeecheungjoyeecheungFeb 12, 2017

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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.

Comment threaddoc/api/errors.md
[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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@joyeecheungjoyeecheung 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
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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

@seppevs

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
Member

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
Copy Markdown
Member

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

@fhinkelfhinkel closed this May 23, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blockedPRs that are blocked by other issues or PRs.errorsIssues and PRs related to JavaScript errors originated in Node.js core.netIssues and PRs related to the net subsystem.semver-majorPRs 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.

7 participants

@seppevs@joyeecheung@jasnell@fhinkel@thefourtheye@refack@nodejs-github-bot