Conversation
There was a problem hiding this comment.
Pull request overview
Improves robustness of the backend “fun fact” scheduled job by adding defensive handling for unexpected/empty third-party API responses, and adds a scheduler-level catch around the job invocation.
Changes:
- Add explicit checks for empty/missing payloads from API Ninjas, Quote API, and Wikipedia “On This Day” API.
- Make Quote API parsing tolerant of missing nested fields and return an error payload when no quote is present.
- Wrap the fun-fact cron invocation with a
.catch(...)handler (though the current job implementation already catches internally).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/backend/src/jobs/fun-fact.job.ts | Adds guards/early exits for empty or missing API response fields to avoid runtime crashes. |
| packages/backend/src/index.ts | Adds a cron-level rejection handler for the fun-fact job invocation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
packages/backend/src/jobs/fun-fact.job.ts:151
- The
catchbranch always returnserror: 'Issue with quote API - non 200 status code', but Axios can throw for network/timeouts/other failures as well, so this message can be misleading. Consider using a more general error message and/or including the caught error details (e.g., for logging) so operational troubleshooting isn’t obscured.
} catch {
return { text: '', error: 'Issue with quote API - non 200 status code' };
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot failing checks |
Fixed in commit
|
.catch(...)wrapper in index.ts@typescript-eslint/no-explicit-anylint error (replacedanywithRecord<string, unknown>)