Include the 'textStatus' field in DC.ajax rejection

This commit is contained in:
riking 2014-06-15 22:23:54 -07:00
parent 4e1f76d3b9
commit 0612018569

View file

@ -54,7 +54,7 @@ Discourse.Ajax = Em.Mixin.create({
};
var oldError = args.error;
args.error = function(xhr) {
args.error = function(xhr, textStatus) {
// note: for bad CSRF we don't loop an extra request right away.
// this allows us to eliminate the possibility of having a loop.
@ -62,9 +62,11 @@ Discourse.Ajax = Em.Mixin.create({
Discourse.Session.current().set('csrfToken', null);
}
// If it's a parseerror, don't reject
// If it's a parsererror, don't reject
if (xhr.status === 200) return args.success(xhr);
xhr.jqTextStatus = textStatus;
Ember.run(promise, promise.reject, xhr);
if (oldError) oldError(xhr);
};