Skip to content

Commit 8491fea

Browse files
committed
more logs
1 parent 298e0b5 commit 8491fea

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/shared/topcoder/challenges.service.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export class TopcoderChallengesService {
2424
}
2525
});
2626

27-
this.logger.log(`Fetching challenges from: ${url.toString()}`);
27+
const stringUrl = url.toString();
28+
this.logger.log(`Fetching challenges from: "${stringUrl}"`);
2829

2930
const headers: Record<string, string> = {
3031
'Content-Type': 'application/json',
@@ -35,12 +36,17 @@ export class TopcoderChallengesService {
3536
}
3637

3738
this.logger.log(
38-
`Fetching challenges with headers: ${JSON.stringify(headers)}`,
39+
`Fetching challenges with headers: "${JSON.stringify(headers)}"`,
3940
);
4041

41-
return fetch(url.toString(), {
42-
method: 'GET',
43-
headers,
44-
});
42+
try {
43+
return await fetch(stringUrl, {
44+
method: 'GET',
45+
headers,
46+
});
47+
} catch (error) {
48+
this.logger.error(`Error fetching challenges: ${JSON.stringify(error)}`, error);
49+
throw error;
50+
}
4551
}
4652
}

0 commit comments

Comments
 (0)