I'm trying to capture http status codes in angular in service which calls a backend service, i'm facing issues as i see status 204 , but when logging angular show status null, here is what i'm doing in my service:
return this.http.get<JSON>(mybackendsserviceurl)
.do(res => {
})
.catch(res => {
return this.handleError(res);
});
}
private handleError(err: HttpErrorResponse) {
console.log(err.message);
return Observable.throw(err.message);
}
How to catch different errors from backend service, like 204,403,404,500...etc and display a user friendly message for each error? my frontend is calling the service from API gateway and i'm setting the errors in Response Integrations.