Skip to content

Commit

Permalink
connection errors are not silent anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
charlie-tcpip committed Oct 14, 2019
1 parent 053aee1 commit 92010ee
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/openpay.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,14 +789,12 @@ var sendRequest = function (data) {
json: true,
timeout: data.timeout
};
//console.log(data.apiUrl); //console.log(_.extend(baseRequestOptions, data.requestData));
var data = _.extend({}, data);
request(_.extend(baseRequestOptions, data.requestData), function(err, res, body){
var resCode = res.statusCode;
var error = (resCode!=200 && resCode!=201 && resCode!=204) ? body : null;
data.callback(error, error ? null : body, res);
var resCode = res ? res.statusCode : null;
var error = resCode && (resCode!=200 && resCode!=201 && resCode!=204) ? body : null;
data.callback(err ? err : error, err || error ? null : body, res);
});
}
//request('http://www.google.com', function (error, response, body) {})

module.exports = Openpay;

0 comments on commit 92010ee

Please sign in to comment.