Skip to content

Commit

Permalink
fix(get-updates): add logger for improved debugging of API status err…
Browse files Browse the repository at this point in the history
…ors in update retrieval process
  • Loading branch information
guidomodarelli committed Dec 16, 2024
1 parent 0a3faff commit e41576a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export const getUpdates = async (
queryApi = false,
forceQuery = false,
): Promise<AvailableUpdates> => {
const { logger } = getWazuhCheckUpdatesServices();

try {
if (!queryApi) {
const availableUpdates = (await getSavedObject(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit e41576a

Please sign in to comment.