-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Conversation
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.
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'); |
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 use something shorter with the ERR_
prefix. E.g. ERR_NO_DOMAIN
Marking as semver-major defensively. Semver-minor may be ok once we're sure nothing breaks. |
5978a84
to
053ac8d
Compare
@jasnell Thank you for the clarifications. I amended the changes you requested to my previous commit. |
doc/api/errors.md
Outdated
@@ -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 |
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 not sure whether this section belongs here...at least we need to mention that this property doesn't appear in all Error
s, and it is set by Node.js?
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.
@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 :-)
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 taken it out in the updated commit
doc/api/errors.md
Outdated
### 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 |
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: without a valid domain name
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 :)
2e5bcaa
to
1395a3f
Compare
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 |
1395a3f
to
8b7f7ec
Compare
Rebased |
@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 if CI is green
doc/api/errors.md
Outdated
### 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 |
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: url
-> URL
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: 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_DOMAIN', 'Unable to determine the domain name'); |
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: Maybe drop the word the
?
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.
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...
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 if CI is green. Left a few minor comments on prose that should be addressed IMO.
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 if CI is green. Would like the nits about URL
and a period (full stop) addressed, but those can be done when landing probably.
8b7f7ec
to
d6c3bc0
Compare
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. | |||
|
|||
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.
Micro-nit: stray space can be removed?
Looks like this is breaking
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/ |
doc/api/errors.md
Outdated
### 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. |
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.
Perhaps ERR_HTTP_NO_DOMAIN
to make the error more specific to the context.
d6c3bc0
to
1615093
Compare
@fhinkel done |
Are there no test cases that check for this error? If not, one could definitely be added. |
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. |
I'll follow up |
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), orvcbuild test
(Windows) passesAffected core subsystem(s)
https