I am receiving the following error when I make a GET request using jsonp in angularjs. Below is a code snippet being used :
var url = 'https://ap-codereview.us.oracle.com/api/review-requests/' +
getCodereviewId(vm.details.codereview_url) + '?callback=JSON_CALLBACK';
$http.jsonp(url).then(codereviewSuccessFn, codereviewErrorFn);
function codereviewSuccessFn(data, status, headers, config) {
vm.show = true;
vm.codereviewDetails = data.data.review_request;
}
function codereviewErrorFn(data, status, headers, config) {
vm.show = false;
Snackbar.error(
"Make sure you have accepted the security certificate warning when logging into codereview from chrome."+
"Manually accept this warning."
+ data.statusText + " : " + data.status);
//Need logic here to differentiate above error from 404 NOT FOUND
Snackbar.error(vm.details.codereview_url + " does not exist");
}
The response in the developer console on chrome shows me net::ERR_INSECURE_RESPONSE.
GET https://ap-codereview.us.oracle.com/api/review-requests/29113?callback=angular.callbacks._0 net::ERR_INSECURE_RESPONSE
I know why this error is happening, which is not my concern, however I need to configure the error message being displayed in the snackbar based on the error type, which is net::ERR_INSECURE_RESPONSE
. I need to diffrentiate between the ERR_INSECURE_RESPONSE and 404 NOT FOUND messages in general.
My question is how can I access the ERROR type from the returned promise object ? I tried browsing through the object and only found a 404/error in the Status/StatusText.
Any help would be appreciated.