From e41576a6bfc0ab3cdce9e3f9961d8f1aa8704ace Mon Sep 17 00:00:00 2001 From: Guido Modarelli Date: Mon, 16 Dec 2024 14:23:56 -0300 Subject: [PATCH] fix(get-updates): add logger for improved debugging of API status errors in update retrieval process --- .../server/services/updates/get-updates.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts index 5472a04731..973fe24d0d 100644 --- a/plugins/wazuh-check-updates/server/services/updates/get-updates.ts +++ b/plugins/wazuh-check-updates/server/services/updates/get-updates.ts @@ -15,6 +15,8 @@ export const getUpdates = async ( queryApi = false, forceQuery = false, ): Promise => { + const { logger } = getWazuhCheckUpdatesServices(); + try { if (!queryApi) { const availableUpdates = (await getSavedObject( @@ -83,6 +85,7 @@ export const getUpdates = async ( status: getStatus(), }; } catch (error: any) { + logger.debug('[ERROR]: Cannot get the API status'); const errorResponse = { title: error.response?.data?.title, detail: error.response?.data?.detail ?? error.message, @@ -113,8 +116,6 @@ export const getUpdates = async ( ? error : 'Error trying to get available updates'; - const { logger } = getWazuhCheckUpdatesServices(); - logger.error(message); return Promise.reject(error); }