1

I have an angular2 service that makes an http request:

return this._http.post('<%= API_URL %>/authentication/social', JSON.stringify(socialLogin), {headers: this._headers})
  .map((res: Response) => {
    return res.json();
  })
  .catch((error: any) => {
    return Observable.throw(error.json().error || 'Server error');
  });

Whenever my server returns a 500, the catch part is hit to handle the error, but my console already shows the error: "POST http://localhost:5000/authentication/social 500 (Internal Server Error)"

The whole point of catching the error and handle it is to avoid this horrible red output in the console, is it possible?

Thanks :)

Seb
  • 778
  • 1
  • 9
  • 27
  • I see, so it's not actually angular that has some code inside to output the 500 but it's part of chrome? Then I guess there's nothing I can do except maybe return another status code that doesn't generate a red error in the console and handle it? – Seb Jan 15 '17 at 12:28
  • Yes. Or just don't care about http errors being printed to console :) – Yaroslav Admin Jan 15 '17 at 12:49

0 Answers0