Skip to content

Commit

Permalink
chore: use a regex to catch connection issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alfetopito committed Nov 14, 2023
1 parent 0d8676a commit a07b043
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/permit-utils/src/lib/getTokenPermitInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function actuallyCheckTokenIsPermittable(params: GetTokenPermitInfoParams)
try {
tokenName = await getTokenName(tokenAddress, chainId, provider)
} catch (e) {
if (e?.error?.serverError?.code === 'ETIMEDOUT' && !tokenName) {
if (/ETIMEDOUT/.test(e) && !tokenName) {
// Network issue or another temporary failure, return error
return { error: `Failed to fetch token name from contract. RPC connection error` }
}
Expand Down

0 comments on commit a07b043

Please sign in to comment.