Skip to content

Commit b7921cc

Browse files
authored
Log warning for missing XRPL_RPC_URL (#3897)
1 parent 5c89c0f commit b7921cc

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

.changeset/tender-pigs-shake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/token-balance-adapter': patch
3+
---
4+
5+
Log warning instead of error when XRPL_RPC_URL is not set.

packages/sources/token-balance/src/transport/xrpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class XrplTransport extends SubscriptionTransport<BaseEndpointTypes> {
5656
this.requester = dependencies.requester
5757

5858
if (!adapterSettings.XRPL_RPC_URL) {
59-
logger.error('Environment variable XRPL_RPC_URL is missing')
59+
logger.warn('Environment variable XRPL_RPC_URL is missing')
6060
}
6161
}
6262

packages/sources/token-balance/test/unit/xrpl.test.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ jest.mock('ethers', () => ({
3939
}))
4040

4141
const log = jest.fn()
42+
const warningLog = jest.fn()
4243
const logger = {
4344
fatal: log,
4445
error: log,
45-
warn: log,
46+
warn: warningLog,
4647
info: log,
4748
debug: log,
4849
trace: log,
@@ -169,6 +170,7 @@ describe('XrplTransport', () => {
169170

170171
afterEach(() => {
171172
expect(log).not.toBeCalled()
173+
expect(warningLog).not.toBeCalled()
172174
})
173175

174176
describe('initialize', () => {
@@ -184,9 +186,9 @@ describe('XrplTransport', () => {
184186
transportName,
185187
)
186188

187-
expect(log).toBeCalledWith('Environment variable XRPL_RPC_URL is missing')
188-
expect(log).toBeCalledTimes(1)
189-
log.mockClear()
189+
expect(warningLog).toBeCalledWith('Environment variable XRPL_RPC_URL is missing')
190+
expect(warningLog).toBeCalledTimes(1)
191+
warningLog.mockClear()
190192
})
191193
})
192194

@@ -562,9 +564,9 @@ describe('XrplTransport', () => {
562564
tokenIssuerAddress,
563565
}),
564566
).rejects.toThrow('Environment variable XRPL_RPC_URL is missing')
565-
expect(log).toBeCalledWith('Environment variable XRPL_RPC_URL is missing')
566-
expect(log).toBeCalledTimes(1)
567-
log.mockClear()
567+
expect(warningLog).toBeCalledWith('Environment variable XRPL_RPC_URL is missing')
568+
expect(warningLog).toBeCalledTimes(1)
569+
warningLog.mockClear()
568570
})
569571
})
570572
})

0 commit comments

Comments
 (0)