Skip to content

Commit

Permalink
Restore original error handling for .requestSMSCode()
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiandouce committed Apr 13, 2015
1 parent 27b53cc commit d6a2397
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,15 @@ Auth0.prototype.requestSMSCode = function (options, callback) {
}
})
.fail(function (err) {
handleRequestError(err, callback);
try {
callback(JSON.parse(err.responseText));
} catch (e) {
var error = new Error(err.status + '(' + err.statusText + '): ' + err.responseText);
error.statusCode = err.status;
error.error = err.statusText;
error.message = err.responseText;
callback(error);
}
})
.then(function (result) {
callback(null, result);
Expand Down

0 comments on commit d6a2397

Please sign in to comment.