}).fail(function(xhr){
//Authentication and the handling of fail states should be wrapped up into a connection class.
Utils.checkAuthentication(xhr.status);
- var error;
+ var error = null;
if(xhr.responseText) {
try {
- error = JSON.stringify(xhr.responseText);
+ error = JSON.parse(xhr.responseText);
+ error = JSON.parse(error.error)['rpc-reply']['rpc-error']['error-message'];
} catch(e){
-
+ console.log(e);
}
}
reject(error);