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

Calls to request(options, callback) shall never throw an error and call the callback instead #2109

Open
gabmontes opened this issue Mar 2, 2016 · 1 comment
Labels
bug Something to fix

Comments

@gabmontes
Copy link

As discussed briefly in #1429, calls to request(options, callback) shall never throw an error as this is not a recommended error handling pattern. If a function return an error asynchronously, then all the errors including those can be identified right away, shall be returned asynchronously.

var options = {
  url: url,
  method: 'HEAD',
  body: 'Some data'
}
request(options, function (err, response, body) {
  // never called
}) // throws an error instead

For a more detailed discussion on the matter, please refer to Error Handling in Node.js, section "Throw, Callback, or EventEmitter?".

Please consider updating the error handling to always call the provided callback instead of throwing errors.

@stale
Copy link

stale bot commented Nov 23, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 23, 2018
@reconbot reconbot added the bug Something to fix label Nov 23, 2018
@stale stale bot removed the stale label Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something to fix
Projects
None yet
Development

No branches or pull requests

2 participants