I'm facing an issue with my Vue.js single file component where I am trying to catch exceptions when the URL requested by axios.post
is unreachable. I have encapsulated the entire code in a try block, but for some reason, the alert in the catch block is not triggering.
Recently updated with .catch method
deploySelected: function(){
this.showStatus = true ;
// animate open the status window.
$("#status_update").animate({height: '500'})
var url = "http://test-web-machine01.localsite.com:5060/scripts/request_deploy";
axios.post(url)
.then(response => {
if (typeof response.data.reason != "undefined"){
alert("Recieved Status: " + response.data.status + ",\nReason: " + response.data.reason);
}
var req_id = response.data.result.request_id;
this.statusMessage = "Initiating deployment of Scripts for Request ID: " + req_id ;
})
.catch((err) => alert(err))
console.log(url);
}