Skip to content

Commit

Permalink
fix: do not fall through on execution errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Jan 29, 2025
1 parent fe558fd commit 3f8859f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-beans-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

Fixed issue where Transports were falling back on execution errors.
32 changes: 28 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/clients/transports/fallback.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ExecutionRevertedError } from '../../errors/node.js'
import {
TransactionRejectedRpcError,
UserRejectedRequestError,
Expand Down Expand Up @@ -195,6 +196,7 @@ function shouldThrow(error: Error) {
if (
error.code === TransactionRejectedRpcError.code ||
error.code === UserRejectedRequestError.code ||
ExecutionRevertedError.nodeMessage.test(error.message) ||
error.code === 5000 // CAIP UserRejectedRequestError
)
return true
Expand Down

0 comments on commit 3f8859f

Please sign in to comment.