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(logging): add logging for 500 errors #806

Merged
merged 4 commits into from
Aug 1, 2024
Merged
Changes from 3 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
14 changes: 14 additions & 0 deletions lib/handlers/quote/quote.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Joi from '@hapi/joi'

Check failure on line 1 in lib/handlers/quote/quote.ts

View workflow job for this annotation

GitHub Actions / Prettier

lib/handlers/quote/quote.ts#L1

There are issues with this file's formatting, please run Prettier to fix the errors
import { Protocol } from '@uniswap/router-sdk'
import { ChainId, Currency, CurrencyAmount, Token, TradeType } from '@uniswap/sdk-core'
import {
Expand Down Expand Up @@ -126,6 +126,16 @@
1,
MetricLoggerUnit.Count
)
log.error(
{
statusCode: result?.statusCode,
errorCode: result?.errorCode,
detail: result?.detail,
},
`Quote 5XX Error [${result?.statusCode}] on ${ID_TO_NETWORK_NAME(chainId)} with errorCode '${
result?.errorCode
}': ${result?.detail}`
)
break
}
} catch (err) {
Expand All @@ -140,6 +150,10 @@
MetricLoggerUnit.Count
)

log.error(
`Quote 5XX Error on ${ID_TO_NETWORK_NAME(chainId)} with exception '${err}'`,
)

throw err
} finally {
// This metric is logged after calling the internal handler to correlate with the status metrics
Expand Down
Loading