I am trying to call a custom function in my error handling function but it won't work
my initial function looks like this:
register(model: LoginDto) {
return this.http.post(this.baseURL + 'register', model).pipe(
catchError(this.handleError)
);
}
and my Error Handling function like this:
private handleError(error: any) {
console.log(error);
if (error != null && error instanceof HttpErrorResponse) {
if (error.error != null) {
const x = Object.keys(error.error).map(key => error.error[key]);
const y = this.handleHttpError(x);
}
}
return throwError(error);
}
in the Function handleHttpError i would check the error message but when i call it i get the error message TypeError: this.handleHttpError is not a function
what am i doing wrong ?