I have a method for handling errors:
private handleError<T>(operation = 'operation', result?: T) {
return (error: any): Observable<T> => {
console.error(error);
this.log(`${operation} failed: ${error.message}`);
return of(result as T);
};
}
private log(message: string) {
console.log(message);
}
and I want to use it inside my method:
getMyStructure(): Observable<HttpResponse<StructureResponse>> {
return this.http.get< StructureResponse >(
localUrl).pipe(retry(3), catchError(this.handleError<StructureResponse>('getMyStructure', {})));
}
but the last {} throws me an error.
The StructureResponse is an Interface with some fields. In my understanding I should put there some (empty?) object of StructureResponse but I'm no longer sure. Can you help me with that?
this is the StructureResponse:
interface SomeStructure {
content: MyStructure[];
page: number;
size: number;
totalElements: number;
totalPages: number;
last: boolean
}