I need to check if I got an error 401.
For example, this request should cause an error:
let headers = new Headers({ 'Content-Type': 'application/json', 'Authorization': token + 'THIS SHOULD CAUSE AN 401 ERROR ' });
let url = thisObj.amazonUrl + func + argsStr;
let options = new RequestOptions ({ headers: headers});
thisObj.http.get(url, options)
.subscribe(
function(response: any) {
body = JSON.parse(response);
cb(null, body);
},
function(error) {
console.error('GET: error);
cb(error);
}
);
But this error response don’t carry any information on error type.
How could I retrieve information o error type?