How would you catch the error in that case:
getStuff(): Observable<Stuff[]> {
return this.http.get(url)
.map((res: Response) => {
return res.json()
.map(item => {
return {
id: item.id
name: item.code
};
});
});
}
I tried to put .catch()
but saying that return type is not matching Supplied parameters do not match any signature of call target.
getStuff(): Observable<Stuff[]> {
return this.http.get(url)
.map((res: Response) => {
return res.json()
.map(item => {
return {
id: item.id
name: item.code
};
});
})
.catch();
}
with .catch((err) => console.error(err));
getting
Argument of type '(err: any) => void' is not assignable to parameter of type '(err: any, caught: Observable<any>) => ObservableInput<{}>'.
Type 'void' is not assignable to type 'ObservableInput<{}>'.