ladjs / superagent

Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
https://ladjs.github.io/superagent/
MIT License
16.59k stars 1.33k forks source link

Response object is not sent to callback #1554

Open pszalko opened 4 years ago

pszalko commented 4 years ago

It looks like the response object is not sent back to callback when an exception is thrown:

this.on('end', function () {
    var err = null;
    var res = null;

    try {
      res = new Response(self);
    } catch (err_) {
// ... 
      return self.callback(err); // <-- HERE 
    }
// ... 
});