Added meaningful message when fetching API fails

This commit is contained in:
Jesús Ángel 2019-01-03 11:36:37 +01:00
parent aa85d707c7
commit d7dc14a4cf

View File

@ -212,15 +212,18 @@ export class Monitoring {
if (!response.error && ((response.body || {}).data || {}).totalItems) {
await this.checkStatus(api, response.body.data.totalItems);
} else {
const msg = ((response || {}).body || {}).message || false;
!this.quiet &&
log(
'[monitoring][checkAndSaveStatus]',
'Wazuh API credentials not found or are not correct. Open the app in your browser and configure it to start monitoring agents.'
msg ||
'Wazuh API credentials not found or are not correct. Open the app in your browser and configure it to start monitoring agents.'
);
!this.quiet &&
this.server.log(
[blueWazuh, 'monitoring', 'error'],
'Wazuh API credentials not found or are not correct. Open the app in your browser and configure it to start monitoring agents.'
msg ||
'Wazuh API credentials not found or are not correct. Open the app in your browser and configure it to start monitoring agents.'
);
}
return;