I'm having a hard time understanding the behavior I get on http calls with errors.
The goal is to have different behaviors based on the error message returned by the server on 403, or 400 responses.
When using Chrome network I can see the message
But when doing a console.log of the error all I get is an ProgressEvent object in the body.
The code in question is quite simple, and the 200 are handled fine with the json returned being accesible.
this.service.myFunction(this.email).subscribe(
auth => console.log(auth), // works fine
error => console.log(error)
);
I also tried with a catch, on the actual call, but no luck.
this.myFunction.get(url).map(res => res.json())
.catch( (err: Response) => Observable.throw(err.json()) ); // throw the error, which is also the object described above
Do you have any idea of what I'm doing wrong?
Thanks