From 09c2c96b5e320fbe2c79e73bffebb34d275a8fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20=C3=81ngel=20Gonz=C3=A1lez?= Date: Thu, 21 Dec 2017 15:23:09 +0100 Subject: [PATCH] Handled two more error cases --- public/services/testAPI.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/services/testAPI.js b/public/services/testAPI.js index 47bd23658..b6892f247 100644 --- a/public/services/testAPI.js +++ b/public/services/testAPI.js @@ -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); } });