function registrationSave(data){
return $http({
method: 'POST',
url: 'registration/save',
data: data
}).then(function(response){
console.log("@@@1 "+JSON.stringify(response));
},function(error){
console.log("@@@2"+JSON.stringify(error));
return error.data;
}).catch(function (data) {
// Handle error here
});
};
THis is the server response for the service in case of error
//Server response
{
"code": 400,
"message": "Failled with registration Id 1,341.",
"result": "False"
}
In case of 400 error client code response is undefined ? It never going to error section in the client code.
Why is it so ?
This is the interceptor used
/**
* To handle error response.
*/
function responseError(error) {
if (error.status === 401 || error.status === 403) {
if(error.data != null && error.data.code === 401 ){ //access denied error
toaster.error( 'Access denied', 'User does not have privilege');
}
}
}
In case of 400, Can I return back to the method here ?