Merge pull request #5654 from jaredevantabor/invalid-search-error

adding better error handling for smart search
This commit is contained in:
Jared Tabor
2017-03-07 14:15:17 -08:00
committed by GitHub

View File

@@ -260,9 +260,15 @@ export default ['$q', 'Rest', 'ProcessErrors', '$rootScope', 'Wait', 'DjangoSear
}.bind(this)); }.bind(this));
}, },
error(data, status) { 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!', hdr: 'Error!',
msg: "Invalid search term entered." msg: `Invalid search term entered. GET returned: ${status}`
}); });
} }
}; };