Skip to content

Commit

Permalink
Add 'error' event handler to http.request
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Mar 29, 2012
1 parent 48f2dec commit c01f318
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions node/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ var StatHat = {
callback(res.statusCode, chunk);
});
});

request.on('error', function(e) {
if (!e) e = {};
//console.error("StatHat HTTP error: "+e.message);
callback(600,e.message);
});

request.write(qs);

request.end();
Expand Down

0 comments on commit c01f318

Please sign in to comment.