Skip to content

Commit a11f786

Browse files
authored
Improve NOMIA EA Logging (#4049)
* Improve NOMIA EA Logging * add changeset * remove info log
1 parent 5737257 commit a11f786

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

.changeset/brave-owls-cross.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/nomia-adapter': patch
3+
---
4+
5+
Add deeper logging to NOMIA EA

packages/sources/nomia/src/transport/price.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
4848
})
4949
},
5050
parseResponse: (params, response) => {
51-
logger.info(`🔍 parseResponse called length ${params.length}`)
52-
5351
// Validate basic response structure
5452
if (!response.data || typeof response.data !== 'object') {
55-
logger.error('Invalid response from BEA API - not an object', response.data)
53+
logger.error(
54+
`Invalid response from BEA API - not an object error: ${JSON.stringify(response.data)}`,
55+
)
5656
return params.map((param) => ({
5757
params: param,
5858
response: {
@@ -65,7 +65,7 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
6565
// BEA API responses should have a BEAAPI wrapper, but handle any top-level key
6666
const responseKeys = Object.keys(response.data)
6767
if (responseKeys.length === 0) {
68-
logger.error('Empty response from BEA API', response.data)
68+
logger.error(`Empty response from BEA API error: ${JSON.stringify(response.data)}`)
6969
return params.map((param) => ({
7070
params: param,
7171
response: {
@@ -80,11 +80,13 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
8080
const beaApiData = response.data[topLevelKey]
8181

8282
if (!beaApiData || typeof beaApiData !== 'object' || !beaApiData.Results) {
83-
logger.error('Invalid BEA API response structure - missing Results', {
84-
topLevelKey,
85-
responseData: response.data,
86-
availableKeys: responseKeys,
87-
})
83+
logger.error(
84+
`Invalid BEA API response structure - missing Results error: ${JSON.stringify({
85+
topLevelKey,
86+
responseData: response.data,
87+
availableKeys: responseKeys,
88+
})}`,
89+
)
8890
return params.map((param) => ({
8991
params: param,
9092
response: {
@@ -99,11 +101,13 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
99101
// Check for BEA API errors and log them
100102
if (beaResults.Error) {
101103
const { APIErrorCode, APIErrorDescription } = beaResults.Error
102-
logger.error('BEA API Error', {
103-
errorCode: APIErrorCode,
104-
errorDescription: APIErrorDescription,
105-
requestParams: params.map((p) => p.query).join(', '),
106-
})
104+
logger.error(
105+
`BEA API Error: error: ${JSON.stringify({
106+
errorCode: APIErrorCode,
107+
errorDescription: APIErrorDescription,
108+
requestParams: params.map((p) => p.query).join(', '),
109+
})}`,
110+
)
107111

108112
return params.map((param) => ({
109113
params: param,
@@ -116,7 +120,7 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
116120

117121
// Check for missing data - keep original behavior
118122
if (!beaResults.Data?.length) {
119-
logger.error('No data found in response', response.data)
123+
logger.error(`No data found in response error: ${JSON.stringify(response.data)}`)
120124
return []
121125
}
122126

0 commit comments

Comments
 (0)