testing an error handler
not so great...
JavaScript
function getErrorMsg(error) {
return error.message || (error.data && typeof error.data === 'object') ? (error.data.message + " - " + error.data.errors.toString()) : null || (error.data && typeof error.data === 'string') ? (error.data.message + " - " + error.data.substring(0, 200)) : null || JSON.stringify(error);
}
var errorObj = {
data: undefined,
message: 'MESSAGE'
};
console.log(getErrorMsg(errorObj))