Wagmi提交区块链交易时Windows浏览器无详细错误信息排查
Windows浏览器中Wagmi交易错误信息缺失问题
使用Wagmi向区块链提交一笔大概率已回滚的交易时,Windows电脑上的任意浏览器仅能显示Error类的基础信息,日志如下:
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)
但运行完全相同的代码(托管在同一Windows电脑),在Mac端的同一款浏览器中却能显示完整的错误详情:
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) Version: viem@2.7.6 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)
两个错误均触发于同一行getContractError.js:34。
请问这是什么原因?是否是Windows端Chrome和Edge浏览器的配置导致错误信息被隐藏?如何在Windows端获取包含问题原因的完整错误信息?提交错误交易后本该得到有意义的错误说明,但目前几乎获取不到有效内容。
内容的提问来源于stack exchange,提问作者King Witcher
相关产品推荐
相关产品推荐

