refactor: XHR errors have response/code fields

So that there's no chance of data loss and it's trivial to get the response code (because it's hella useful)

Fixes #1866
Fixes #1876
This commit is contained in:
Pat Cavit 2017-07-18 22:53:17 -07:00
parent 1a1ae8e843
commit 5aac004709
2 changed files with 6 additions and 4 deletions

View file

@ -93,7 +93,8 @@ module.exports = function($window, Promise) {
}
else {
var error = new Error(xhr.responseText)
for (var key in response) error[key] = response[key]
error.code = xhr.status
error.response = response
reject(error)
}
}