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

doc: clarify http error events after calling destroy() #46903

Merged
merged 1 commit into from
Mar 26, 2023

Conversation

zbjornson
Copy link
Contributor

Clarifies the errors after calling destroy(), as well as aborting a passed AbortController.


Aside, the statement "Passing an AbortSignal and then calling abort() on the corresponding AbortController will behave the same way as calling .destroy()" appears correct for Node.js v19, but incorrect for Node.js v16 (didn't test versions between those). Specifically, calling controller.abort() after the 'response' event has no effect in v16.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem. labels Mar 1, 2023
`AbortController` will behave the same way as calling `.destroy()` on the
request itself.
request. Specifically, the `'error'` event will be emitted with an error with
Copy link
Member

Choose a reason for hiding this comment

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

Nit

Suggested change
request. Specifically, the `'error'` event will be emitted with an error with
request itself. Specifically, the `'error'` event will be emitted with an error with

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was going for brevity. "Itself" doesn't seem to add clarity. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I dont think its a necessary change to this pr, Id leave it as it was previously

Comment on lines +3725 to +3726
request. Specifically, the `'error'` event will be emitted with an error with
the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`
Copy link
Member

@marco-ippolito marco-ippolito Mar 2, 2023

Choose a reason for hiding this comment

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

Suggested change
request. Specifically, the `'error'` event will be emitted with an error with
the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`
request. Specifically, the `'error'` event will be emitted with the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This parallels the wording in the bullet points above and makes it clear that the argument is an Error and not a string.

Copy link
Member

Choose a reason for hiding this comment

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

It sounds a bit reduntant to me, feel free to ignore

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@lpinca lpinca added the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 26, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 26, 2023
@nodejs-github-bot nodejs-github-bot merged commit f0ade70 into nodejs:main Mar 26, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in f0ade70

@zbjornson zbjornson deleted the doc-http-destroy branch March 26, 2023 21:09
RafaelGSS pushed a commit that referenced this pull request Apr 5, 2023
PR-URL: #46903
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Apr 6, 2023
RafaelGSS pushed a commit that referenced this pull request Apr 6, 2023
PR-URL: #46903
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Apr 7, 2023
PR-URL: #46903
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
danielleadams pushed a commit that referenced this pull request Jul 6, 2023
PR-URL: #46903
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants