Handled two more error cases

This commit is contained in:
Jesús Ángel González 2017-12-21 15:23:09 +01:00
parent 928dbef527
commit 09c2c96b5e

View File

@ -32,11 +32,15 @@ require('ui/modules').get('app/wazuh', [])
}
})
.catch(error => {
if(error.status && error.status === -1){
if(error.data && error.data.message && error.data.message.includes('ENOTFOUND')) {
defered.reject({data: 'invalid_url'});
} else if(error.data && error.data.message && error.data.message.includes('ECONNREFUSED')) {
defered.reject({data: 'invalid_port'});
} else if(error.status && error.status === -1){
defered.reject({data: 'request_timeout_checkapi'});
} else if (error.data && error.data.message && error.data.message === 'wrong_credentials') {
defered.reject({data: 'wrong_credentials'});
}else if (error.error) {
} else if (error.error) {
defered.reject(error);
}
});