Skip to content

Commit 58653c9

Browse files
committed
add logging
1 parent 388aa04 commit 58653c9

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/common/utils/tokenList.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@ export type TokenListItem = {
1717

1818
const cache: Record<number, TokenListItem[]> = {}
1919
;(function buildCache() {
20-
const dir = `${__dirname}/../tokenLists`
21-
const files = fs.readdirSync(dir)
20+
let dir = `${__dirname}/../tokenLists`
21+
let files
22+
try {
23+
files = fs.readdirSync(dir)
24+
} catch {
25+
dir = `${__dirname}/../../../tokenLists`
26+
files = fs.readdirSync(dir)
27+
}
2228
for (const file of files) {
2329
const match = file.match(/(\d+)/g)
2430
if (!match) throw new Error("Invalid tokenlist file")

src/swapService/strategies/balmySDK/pendleQuoteSource.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,12 @@ export class CustomPendleQuoteSource
184184
})
185185

186186
if (!response.ok) {
187-
failed(
188-
PENDLE_METADATA,
189-
chainId,
190-
sellToken,
191-
buyToken,
192-
(await response.text()) || `Failed with status ${response.status}`,
193-
)
187+
const msg =
188+
(await response.text()) || `Failed with status ${response.status}`
189+
190+
if (response.status === 400) console.log("[PENDLE ERROR]", msg, url)
191+
192+
failed(PENDLE_METADATA, chainId, sellToken, buyToken, msg)
194193
}
195194

196195
const {

0 commit comments

Comments
 (0)