From 8491fead7a12b6eab4fce2554cbc4788c2f4f165 Mon Sep 17 00:00:00 2001 From: Vasilica Olariu Date: Thu, 10 Jul 2025 19:00:57 +0300 Subject: [PATCH] more logs --- src/shared/topcoder/challenges.service.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/shared/topcoder/challenges.service.ts b/src/shared/topcoder/challenges.service.ts index ed294a9..372d829 100644 --- a/src/shared/topcoder/challenges.service.ts +++ b/src/shared/topcoder/challenges.service.ts @@ -24,7 +24,8 @@ export class TopcoderChallengesService { } }); - this.logger.log(`Fetching challenges from: ${url.toString()}`); + const stringUrl = url.toString(); + this.logger.log(`Fetching challenges from: "${stringUrl}"`); const headers: Record = { 'Content-Type': 'application/json', @@ -35,12 +36,17 @@ export class TopcoderChallengesService { } this.logger.log( - `Fetching challenges with headers: ${JSON.stringify(headers)}`, + `Fetching challenges with headers: "${JSON.stringify(headers)}"`, ); - return fetch(url.toString(), { - method: 'GET', - headers, - }); + try { + return await fetch(stringUrl, { + method: 'GET', + headers, + }); + } catch (error) { + this.logger.error(`Error fetching challenges: ${JSON.stringify(error)}`, error); + throw error; + } } }