Include revert data in the contract execution error types #3519
Unanswered
PaulRBerg
asked this question in
Idea / Feature Request
Replies: 1 comment
-
We can make |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
There are situations where it is useful to investigate the revert data in a frontend environment, e.g., when performing a call to
simulateAndRevert
to check the gas consumption of a Safe tx without actually submitting that tx.The problem is that Viem doesn't include the revert data in
BaseError
or any other contract interaction-related error, e.g.,CallExecutionError
. None of the following fields contain the revert data:cause
,docsPath
,metaMessages
.It is actually possible to revert the data, but that has to be done through walking the error:
This is really not intuitive and there's no documentation about this
walk
method that is available for the error types.Our team has spent days debugging an issue that would have taken much less time if we had known about
walk
. And it looks like others have encountered the same issue, too.Suggested Solution
Make the revert data available in the
BaseError
type.Alternatively, create a new type called
ExecutionError
with a fieldrevertData
(or justdata
), and make theCallExecutionError
,ContractFunctionExecutionError
, etc., types inherit fromExecutionError
.Beta Was this translation helpful? Give feedback.
All reactions