Monday, June 19, 2017

Do not expect to error catch a 404 coming back off an Observable promise.

this.http.get("http://www.example.com/api/whatever").toPromise().then(

...is not going to play nicely with example.com not existing outright. To avoid a blow up you will want to wrap this line of code in a try/catch. How realistic is it to worry about your endpoint not being there? Well, you're still reading, aren't you?

No comments:

Post a Comment