I’m using Wagmi to submit a transaction to the blockchain, which is probably reverting but, if I run on any browser on my Windows pc, I don’t get any error message logged more than the Error class:
Uncaught (in promise) ContractFunctionExecutionError
at getContractError (getContractError.js:34:12)
at simulateContract (simulateContract.js:83:98)
at async simulateContract (simulateContract.js:30:33)
at async writeContract (writeContract.js:29:46)Caused by: ContractFunctionZeroDataError
at eval (getContractError.js:22:20)
at getContractError (getContractError.js:33:7)
at simulateContract (simulateContract.js:83:98)
at async simulateContract (simulateContract.js:30:33)
at async writeContract (writeContract.js:29:46)
The strange part is that, when if I run the EXACT SAME CODE, being hosted on the same Windows pc, on the same browser, but on a Mac, the log is totally different and shows something like:
Uncaught (in promise) ContractFunctionExecutionError: The contract function "approve" returned no data ("0x").
This could be due to any of the following:
- The contract does not have the function "approve",
- The parameters passed to the contract function may be invalid, or
- The address is not a contract.
Contract Call:
address: 0x**** (some ERC20 contract address)
function: approve(address spender, uint256 amount)
args: (0x******* , 41700000000000000)
sender: 0x**** (my wallet address)
Docs: https://viem.sh/docs/contract/simulateContract
Version: [email protected]
at getContractError (getContractError.js:34:12)
at simulateContract (simulateContract.js:83:98)
at async simulateContract (simulateContract.js:30:33)
at async writeContract (writeContract.js:29:46)
... (the rest of the stack trace)
Both errors happens on the same getContractError.js:34
line.
What is going on here? Are my Chrome and Edge on Windows misconfigured to hide Error messages or something? How can I get normal error messages here?
I submitted a bad transaction and expected to get a meaningful error message explaining what I did wrong, but got almost nothing.