Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: log errors while fetching fiat rates as a warnings #231

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- process exits after health check fails for more than `HEALTHCHECK_FAIL_THRESHOLD_MS` (default 60s)
- Bump Blockfrost SDK (memory leak in deriveAddress) and other dependencies
- Timeout for requests dispatched by blockfrost SDK set to 30s
- Log errors while fetching fiat rates as a warnings rather than errors
- (Internal) Refactored build step, entrypoint is now `dist/server.js` (previously `dist/src/server.js`)
- (Internal) Upgrade codebase to ESM
- (Internal) Switched from PNP to node-modules linker
Expand Down
2 changes: 1 addition & 1 deletion src/utils/limiter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ pLimiter.on('error', error => {
});

ratesLimiter.on('error', error => {
logger.error(`ratesLimiter error`, error);
logger.warn(`ratesLimiter error`, error);
});
4 changes: 3 additions & 1 deletion src/utils/rates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export const getRatesForDateNoLimit = async (date: number): Promise<Record<strin
}

if (!response?.market_data) {
throw new Error(`Failed to fetch exchange rate for ${coingeckoDateFormat}`);
throw new Error(
`Failed to fetch exchange rate for ${coingeckoDateFormat}. Invalid response.`,
);
}

return response.market_data?.current_price;
Expand Down
Loading