Skip to content

Commit

Permalink
Handdle HTTP error to avoid throwing exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Barbe committed Dec 17, 2012
1 parent 7f74e6d commit d437872
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/sendgrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ SendGrid.prototype.send = function(email, callback) {
var json = JSON.parse(content);
cb(json.message == 'success', json.errors);
});
}).on('error', function(error){
return callback(false, error);
});

// If the email has files, it will be a multipart request.
Expand Down

0 comments on commit d437872

Please sign in to comment.