Skip to content

Commit

Permalink
fix: lower cases error msg before regex check
Browse files Browse the repository at this point in the history
  • Loading branch information
ganchoradkov committed Jul 3, 2024
1 parent c8b8809 commit 728e218
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/ethers/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,8 @@ export class Web3Modal extends Web3ModalScaffold {
EthersStoreUtil.setChainId(chainId)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (switchError: any) {
if (/(?<temp1>user rejected)/u.test(switchError?.message)) {
const message = switchError?.message as string
if (/(?<temp1>user rejected)/u.test(message?.toLowerCase())) {
throw new Error('Chain is not supported')
}
await EthersHelpersUtil.addEthereumChain(
Expand Down
3 changes: 2 additions & 1 deletion packages/ethers5/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,8 @@ export class Web3Modal extends Web3ModalScaffold {
EthersStoreUtil.setChainId(chainId)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (switchError: any) {
if (/(?<temp1>user rejected)/u.test(switchError?.message)) {
const message = switchError?.message as string
if (/(?<temp1>user rejected)/u.test(message?.toLowerCase())) {
throw new Error('Chain is not supported')
}
await EthersHelpersUtil.addEthereumChain(
Expand Down

0 comments on commit 728e218

Please sign in to comment.