Currently, I am utilizing Angular 4's HttpClient
for communicating with an external service. The setup is quite standard:
this.httpClient.get(url).subscribe(response => {
//do something with response
}, err => {
console.log(err.message);
}, () => {
console.log('completed');
}
An issue arises when the request fails as it displays a generic
Http failure response for (unknown url): 0 Unknown Error
message in the console. However, upon inspecting the failed request in Chrome, I am able to view that the response status is 422, and under the "preview" tab, there is a detailed message explaining the cause of the failure.
How can I retrieve the actual response message visible in Chrome Developer Tools?
Refer to this screenshot illustrating the problem: https://i.sstatic.net/UUp2f.png