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

Callback exception handling #176

Closed
diogogmt opened this issue Oct 21, 2013 · 3 comments
Closed

Callback exception handling #176

diogogmt opened this issue Oct 21, 2013 · 3 comments

Comments

@diogogmt
Copy link

If an exception happens in the callback of the request the error is not bubbled up.
I can see in the lib/service.js at the makeRequest method that the callback is registered with the request object.

Is there a way to make the exception within the callback be bubbled up to the function that made the request?

For example:

cloud.describeInstances(args, function (err, data) {
    null.crash
});

The exception won't be handled, it will just hang

@lsegal
Copy link
Contributor

lsegal commented Oct 23, 2013

We went back and forth on this a few times. Bubbling the exception up will actually cause it to get bubbled up to the send lifecycle event handler, which makes the request get retried on the service a number of times even if it is successful. We had turned on bubbling in #74 but had to revert due to #131.

The best way to handle these errors it to use domain support inside of nodejs and allow the domain handler to catch the exception.

@lsegal
Copy link
Contributor

lsegal commented Jan 10, 2014

Closing this due to age. We recommend using domains when trying to bubble up errors. If you are having issues getting domains to work properly, please open a new issue for that.

Thanks for reporting this.

@lock
Copy link

lock bot commented Sep 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants