Pass if unable to handle failed ajax response (#3797)

This commit is contained in:
Nabin Hait 2017-07-27 11:21:15 +05:30 committed by Rushabh Mehta
parent 9174b245d8
commit ff248fd4fa

View file

@ -177,8 +177,8 @@ frappe.request.call = function(opts) {
status_code_handler(data, xhr);
}
} catch(e) {
console.log("Unable to handle response");
console.trace(e);
console.log("Unable to handle success response"); // eslint-disable-line
console.trace(e); // eslint-disable-line
}
})
@ -201,12 +201,17 @@ frappe.request.call = function(opts) {
}
})
.fail(function(xhr, textStatus) {
var status_code_handler = statusCode[xhr.statusCode().status];
if (status_code_handler) {
status_code_handler(xhr);
} else {
// if not handled by error handler!
opts.error_callback && opts.error_callback(xhr);
try {
var status_code_handler = statusCode[xhr.statusCode().status];
if (status_code_handler) {
status_code_handler(xhr);
} else {
// if not handled by error handler!
opts.error_callback && opts.error_callback(xhr);
}
} catch(e) {
console.log("Unable to handle failed response"); // eslint-disable-line
console.trace(e); // eslint-disable-line
}
});
}