-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Version: master
What was wrong?
Whenever a contract function call fails, for whatever reason, it throws an unspecified ValueError
, which pops up through all the call stack. For libraries on top it's not possible to properly reason and deal with such an unspecific error. This problem shows up in a lot of issue reports, e.g. #1725 #1717 #651 and nosofa/uniswap-v2-py#10 .
How can it be fixed?
To my humble understanding, this should best be handled somewhere in call_contract_function()
Line 1470 in d8996bd
def call_contract_function( |
Line 1528 in d8996bd
raise BadFunctionCallOutput(msg) from e |
BadFunctionCallOutput
. Imho the two function calls in Line 1497 in d8996bd
return_data = web3.eth.call(call_transaction) |
BadFunctionCallOutput
or another more specific error.
Another and maybe even the better option might be, to replace all the ValueError
and KeyError
in https://github.com/ethereum/web3.py/blob/master/web3/manager.py with some kind of server side response error right away.