-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
pass the original error message to the catched error #450
Comments
@gjohnson |
maybe something like that: this.on('end', function(){
var res;
try {
res = new Response(self);
} catch(e) {
var err = new Error('Parser is unable to parse the response');
err.parse = true;
err.original = e;
self.callback(err);
}
if ('HEAD' == method) res.text = null;
try {
self.callback(null, res);
} catch(e) {
self.callback(e);
}
});
} |
+1 |
+1 |
1 similar comment
👍 |
This has been fixed in master. The callback is not in the try/catch anymore. |
Any word on a publish?
|
Yea, I am trying to blow through the issue backlog today and tomorrow and want to try to get an RC out tomorrow but can't promise anything. If you want to use master today you can certainly just reference git commits directly. |
superagent is catching all errors: https://github.com/visionmedia/superagent/blob/f106c7226758a22f633d0cf1607b5bb6a3ce264e/lib/client.js#L458
so if you make a request and get a runtime error in the response callback it's totally annoying, because you only get a Parser is unable to parse the response and you need to debug it to get the origin error message, which has nothing to do with parsing the response.
The text was updated successfully, but these errors were encountered: