Store.sync() method have success and failure property-functions, they have Ext.data.Batch and options as parameters.
Any failed operations collecting inside batch.exceptions
array. It has all what you need.
Just go through the failed operations, processing them.
Operation failure message ("test error!") would be inside - operation.error
store.sync({
failure: function(batch, options) {
Ext.each(batch.exceptions, function(operation) {
if (operation.hasException()) {
Ext.log.warn('error message: ' + operation.error);
}
});
}
});
Proxy set it inside processResponse method:
operation.setException(result.message);
Where:
- Operation's setException method sets its
error
property (error message there).
result
is Ext.data.ResultSet and the result.message
if filled by the proxy's reader, using the reader's messageProperty
But, by default reader's message property is messageProperty: 'message'
.
In your case you should configured the reader with correct messageProperty, like:
reader: {
...
messageProperty: 'msg'
}
or return from the server response with metadata
configuration property, like:
{
"success": false,
"msg": "test error!",
"metaData": {
...
"messageProperty": 'msg'
}
}
Json reader - Response MetaData (docs section)