PDA

View Full Version : What is the right way to get the response text to a failed Store operation?



mark0978
14 Nov 2014, 1:06 PM
So I'm saving a record to a store with an AJAX proxy, and I'm trying to get hold of the error message when it fails. Doesn't seem like this should be the way to do it, but I don't see another way.



record.save({
callback: function(records, operation, success) {
maskedElement.showMask(false);
if(!success && operation.error.status == 410) {
msg = operation.request.callback.arguments[2].responseText; // This seems WRONG
} else {
callback && callback();
}
}

slemmon
17 Nov 2014, 12:57 PM
Hi,

In the model's reader you can set the messageProperty which is what the operation's getError() method will read from.
So, you can do something like the following:

dhh