$http error callback doesn't have xhr.statusText
There is no way to get XHR statusText in $http error callback. Currently this only returns status(number - statusCode).
It would be really helpful to get status text to display the server error message in the browser.
Like examples, 404 - Resource not found 400 - User ID already exists
+1 Just ran into this.
@jimlyndon thx for the fix, i hope your pull request will be accepted.
@jimlyndon thank you!
No prob. I have a story on the wall waiting for this fix as well. So we'll see :)
Hi Guys, Anyone know if this is fixed in the trunk?
We're working with another team's backend that we don't really have control over and it would be really nice if we could leverage that system's existing error messages by using the status text.
The PR mentioned above hasn't been pulled, and I don't know if the fix has been satisfied by another, as I haven't heard back from anyone on the PR and have been off the grid w other projects.
But it's an easy fix and super useful. Feel free to comment on the PR thread also. On Jun 15, 2013 3:58 PM, "protoze" [email protected] wrote:
We're working with another team's backend that we don't really have control over and it would be really nice if we could leverage that system's existing error messages by using the status text.
— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/2335#issuecomment-19491846 .
Yep just hit this issue as well = hopefully will be rolled in soon.
Ug, same here, need this. :+1:
+1
Same here, we also need to get the status text of the responses.
statusText is very important, please add it to response
+1
+1, just hit this.
+1
I faced the same problem on version 1.2.24
Is this not available in 1.2.24: See https://github.com/angular/angular.js/commit/32c09c1d195fcb98f6e29fc7e554a867f4762301
same problem on version 1.3.0
for a temporary solution for myself, changed source code as the following:
promise.success = function(fn) {
promise.then(function(response) {
fn(response.data, response.status, response.headers, config, response.statusText);
});
return promise;
};
promise.error = function(fn) {
promise.then(null, function(response) {
fn(response.data, response.status, response.headers, config, response.statusText);
});
return promise;
};
@owen26 we probably arent going to extend those in core because if we ever want to add more it just gets really sucky. why not just use .then() for it?
At least it should be documented somewhere saying statusText will only be available in .then() and not in .success()/.error().