I'm struggling to resolve this issue and I've searched online with no luck. The problem lies in my post call implementation, which looks like this:
return this.http.post(url, body, { headers: ConnectFunctions.getHeader() }).pipe(
map(result => {
return result;
}),
catchError(ConnectFunctions.handleError(url, []))
);
}
Upon making the request, the server responds with the following:
{"status":500,"timestamp":"21-07-2020 03:51:17","message":"my custom message","details":"some details"}
I am aiming to extract the value of the "message" field ("my custom message"), but so far I haven't been successful.
public static handleError<T>(operation = 'operation', result?: T) {
return (error: any): Observable<T> => {
console.log("Error use: " + `${operation} failed: ${error.message}`);
console.log("Error statusText: " + error.statusText);
return of(error as T);
};
}
Any suggestions on how I can achieve this?
Thank you for your assistance.