Http Error handeling

I have a problem with error handling part of http section, is there any update for this part of Course ?

same problem :
When importing ‘rxjs/add/operator/catch’ the catch method doesnt appear.
How can I solve it?

Another problem in this section:
When adding (error: Responce) to deletePost method ( in posts.component.ts ) .subscribe declaration marks as deprecated.

yeah i’m kinda stuck here as well

In newer versions of Angular catch has been replaced with catchError, otherwise you can use rxjs-compat to use those older methods. A bit of refactoring was required to get error handling functioning similarly to how Mosh has it due to updates in Angular and Typescript which can easily be found by googling. Regarding the deprecated issue, I believe this is more of a TSLint issue Deprecation warning on a complete callback without any complete callback · Issue #6060 · ReactiveX/rxjs · GitHub

1 Like


I got stuck here too.

Below is the code that worked for me. I might help others too.

 delete(id: any) {
        return this.http.delete(this.url + '/' + id)
1 Like

There used to be a migration guide on the GitHub page for RxJS. Here’s a link to the state of it at least at one point in time: rxjs/ at 2afd869816f77ef7a154b4db5dd1fbffd382339e · ReactiveX/rxjs · GitHub

This page goes into even more details.

For the most part, you now use the pipe function which takes an array of “Pipeable Operators” like map, filter and catchError (you can read more about those here and the rest of that page has more details about pipes in general).

Two of the main translations we need to use are:

// Before
// Now

// Before
// Now