Double callback on GET request timeout
Opened this issue · 1 comments
deandum commented
With the recent issue that Facebook had, we have been getting a lot of errors generated by the code below:
return request.get(this.options, function(err, res, body) {
if (err) {
self.callback({
message: 'Error processing https request'
, exception: err
}, null);
return;
}
if (~res.headers['content-type'].indexOf('image')) {
body = {
image: true
, location: res.headers.location
};
}
self.end(body);
}).on('error', function(err) {
self.callback({
message: 'Error processing https request'
, exception: err
}, null);
});
The error is caught twice here, resulting in double callbacks and may cause uncaught exceptions if not handled properly.
Sirach99 commented
Lol, this was driving me crazy. Ty!