HttpClient is the preferred way to make http calls from an Angular app. It is simple and straightforward to use, returning an Observable<T>. All you have to do is subscribe and the callback will be invoked when the data comes back from the server.
But what about error handling?
In a perfect world, everything would work and follow the happy path… but that’s not really how things work.
HttpErrorResponse
Angular provides an object for describing what went wrong. HttpErrorResponse is returned when anything goes wrong – from initializing the call to executing the call to the result returned from the server – so its really all you need to properly handle the error.
Additional Resources
This Angular Guide does a pretty good job of getting in to all of HttpClient, but this post was more of a way for me to make a quick reference for the bits that I end up using the most often.