I'm wrinting a pice of Angular2 code that interacts with a server which returns a json with http error codes such as 404 or 401. I can't find a way to read the json out of the error response. I can't use .map() since there is no data on normal response.
return new Promise((resolve, reject: Response) => {
this.http.request(new Request(requestoptions))
.subscribe(
data => {resolve()},
error => { error.json() } //<-- No json()
)
};
How handle this?