Skip to content

Commit

Permalink
Merge pull request #64 from bettiolo/better-error-messasge
Browse files Browse the repository at this point in the history
Unexpeced errors were not handled correctly
  • Loading branch information
apocas authored Jun 23, 2016
2 parents f086f7c + f47544d commit fc72bde
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/modem.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ Modem.prototype.buildPayload = function(err, isStream, statusCodes, openStdin, r
if (statusCodes[res.statusCode] !== true) {
getCause(isStream, res, json, function(err, cause) {
var msg = new Error(
'HTTP code is ' + res.statusCode + ' which indicates error: ' + statusCodes[res.statusCode] + ' - ' + cause
'(HTTP code ' + res.statusCode + ') '
+ (statusCodes[res.statusCode] || 'unexpected') + ' - '
+ (cause.message || cause) + ' '
);
msg.reason = statusCodes[res.statusCode];
msg.statusCode = res.statusCode;
Expand Down

0 comments on commit fc72bde

Please sign in to comment.