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

https: use internal/errors.js #11293

Closed
wants to merge 1 commit into from

Conversation

seppevs
Copy link
Contributor

@seppevs seppevs commented Feb 10, 2017

Change https.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
  • commit message follows commit guidelines
Affected core subsystem(s)

https

@nodejs-github-bot nodejs-github-bot added errors Issues and PRs related to JavaScript errors originated in Node.js core. https Issues or PRs related to the https subsystem. labels Feb 10, 2017
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.

Thank you for jumping in on this! I really do appreciate it!

There are still a couple of things that need to be done on this. Please take a look at my PR #11294 as an example. Documentation for the error code should be added to the end of doc/api/errors.md the same way I do so in #11294. Feel free to duplicate some of the boilerplate there and we'll work out the conflicts as we review and land PRs.

lib/https.js Outdated
@@ -195,7 +196,7 @@ exports.request = function request(options, cb) {
if (typeof options === 'string') {
options = url.parse(options);
if (!options.hostname) {
throw new Error('Unable to determine the domain name');
throw new errors.Error('UNABLE_TO_DETERMINE_DOMAIN_NAME');
Copy link
Member

Choose a reason for hiding this comment

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

Please use something shorter with the ERR_ prefix. E.g. ERR_NO_DOMAIN

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

jasnell commented Feb 10, 2017

Marking as semver-major defensively. Semver-minor may be ok once we're sure nothing breaks.

@seppevs
Copy link
Contributor Author

seppevs commented Feb 10, 2017

@jasnell Thank you for the clarifications. I amended the changes you requested to my previous commit.

@@ -255,6 +255,13 @@ will affect any stack trace captured *after* the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will
not capture any frames.

#### error.code
Copy link
Member

@joyeecheung joyeecheung Feb 10, 2017

Choose a reason for hiding this comment

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

I am not sure whether this section belongs here...at least we need to mention that this property doesn't appear in all Errors, and it is set by Node.js?

Copy link
Member

Choose a reason for hiding this comment

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

@seppevs ... yeah, I'll take care of this section in one of the other PRs. If you would, go ahead and pull this particular bit back out :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've taken it out in the updated commit

### ERR_NO_DOMAIN

An error using the `'ERR_NO_DOMAIN'` code is thrown specifically when an attempt
is made to parse an url without a domain name
Copy link
Member

Choose a reason for hiding this comment

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

nit: without a valid domain name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed :)

@seppevs seppevs force-pushed the https_use_internal_errors branch 3 times, most recently from 2e5bcaa to 1395a3f Compare February 10, 2017 21:10
@joyeecheung
Copy link
Member

@seppevs
Copy link
Contributor Author

seppevs commented Feb 22, 2017

The github jenkins bot (see comment with "some checks were not successful") reports that test/arm failed. But when I click through, I see that the build was successful? https://ci.nodejs.org/job/node-test-commit-arm/7774/console

@seppevs
Copy link
Contributor Author

seppevs commented May 1, 2017

Rebased

@joyeecheung
Copy link
Member

@jasnell
Copy link
Member

jasnell commented May 2, 2017

@nodejs/ctc ... this is ready to go, but as a semver-major needs another CTC member to sign off.

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

LGTM if CI is green

### ERR_NO_DOMAIN

An error using the `'ERR_NO_DOMAIN'` code is thrown specifically when an attempt
is made to parse an url without a valid domain name
Copy link
Member

Choose a reason for hiding this comment

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

Nit: url -> URL

Copy link
Member

Choose a reason for hiding this comment

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

Nit: Period at the end of the sentence.

@@ -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_DOMAIN', 'Unable to determine the domain name');
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Maybe drop the word the?

Copy link
Member

Choose a reason for hiding this comment

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

Although I see it was a copy/paste from the existing error message, so certainly feel free to keep it that way if you'd prefer...

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

LGTM if CI is green. Left a few minor comments on prose that should be addressed IMO.

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

LGTM if CI is green. Would like the nits about URL and a period (full stop) addressed, but those can be done when landing probably.

@seppevs seppevs force-pushed the https_use_internal_errors branch from 8b7f7ec to d6c3bc0 Compare May 3, 2017 06:51
@seppevs
Copy link
Contributor Author

seppevs commented May 3, 2017

Changes done

@@ -558,7 +558,7 @@ found [here][online].
the connected party did not properly respond after a period of time. Usually
encountered by [`http`][] or [`net`][] -- often a sign that a `socket.end()`
was not properly called.

Copy link
Member

Choose a reason for hiding this comment

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

Micro-nit: stray space can be removed?

@joyeecheung
Copy link
Member

Looks like this is breaking test-benchmark-crypto.js on win2016...

Error: Cannot find module 'c:\workspace\node-test-binary-windows\RUN_SUBSET\0\VS_VERSION\vs2015\label\win2016\benchmark\crypto\hash-stream-creation.js'

Not sure how this happens..just in case it's something wrong with the build step, have another CI: https://ci.nodejs.org/job/node-test-pull-request/7847/

### ERR_NO_DOMAIN

An error using the `'ERR_NO_DOMAIN'` code is thrown specifically when an attempt
is made to parse an URL without a valid domain name.
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps ERR_HTTP_NO_DOMAIN to make the error more specific to the context.

@fhinkel
Copy link
Member

fhinkel commented May 23, 2017

@seppevs Do you want to address @jasnell 's comment and rebase? Thanks!

@seppevs seppevs force-pushed the https_use_internal_errors branch from d6c3bc0 to 1615093 Compare May 24, 2017 07:28
@seppevs
Copy link
Contributor Author

seppevs commented May 24, 2017

@fhinkel done

@jasnell
Copy link
Member

jasnell commented May 24, 2017

Are there no test cases that check for this error? If not, one could definitely be added.

@fhinkel
Copy link
Member

fhinkel commented Jun 7, 2017

I'm closing this because it's been inactive for quite a while. Feel free to reopen or ping a collaborator to get it reopened if needed.

@fhinkel fhinkel closed this Jun 7, 2017
@refack
Copy link
Contributor

refack commented Jul 19, 2017

I'll follow up

@refack refack reopened this Jul 19, 2017
@refack refack self-assigned this Jul 19, 2017
@BridgeAR
Copy link
Member

I am closing this due to the long inactivity. @refack please do not reopen in case there is no further progress.

@seppevs if you would like to follow up on this, please leave a comment. Thanks a lot for your contribution anyways.

@BridgeAR BridgeAR closed this Sep 20, 2017
@refack refack removed their assignment Oct 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core. https Issues or PRs related to the https 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.

8 participants