adding better error handling for search

This commit is contained in:
jaredevantabor 2017-03-06 14:17:18 -08:00
parent 071f84d224
commit 716718c673

View File

@ -260,9 +260,15 @@ export default ['$q', 'Rest', 'ProcessErrors', '$rootScope', 'Wait', 'DjangoSear
}.bind(this));
},
error(data, status) {
ProcessErrors($rootScope, null, status, null, {
if(data && data.detail){
let error = JSON.parse(data.detail);
if(_.isArray(error)){
data.detail = error[0];
}
}
ProcessErrors($rootScope, data, status, null, {
hdr: 'Error!',
msg: "Invalid search term entered."
msg: `Invalid search term entered. GET returned: ${status}`
});
}
};