I am developing an interceptor for handling http error in angular 10 project. Here is the code:
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class HttpErrorHandlerServiceService implements HttpInterceptor {
constructor() { }
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(req)
.pipe(
map(resp => {
}),
catchError(err => {
})
);
}
}
In catchError operator the below error is showing.
Argument of type '(err: any) => void' is not assignable to parameter of type '(err: any, caught: Observable<void | HttpSentEvent | HttpHeaderResponse | HttpProgressEvent | HttpResponse | HttpUserEvent>) => ObservableInput<...>'. Type 'void' is not assignable to type 'ObservableInput'.
19 catchError(err => {