Is it possible to get the error data thrown by a Custom Exception using web3 in Python?

I only get execution reverted but would like to have all the information about the error. Thanks.

2 Answers 2


Is it possible for you to upload the smart contract code or its address on Etherscan, so I can test it?

web3.exceptions.ContractLogicError always prints the custom revert string if it exists, from my experience.


developer advocate from Chainstack here.

If the transaction is executed in a block, you may get logs like this. This may help you narrow down the root cause of failure. However, this information is solely depending on the contract and may not provide enough detail for debugging purposes.

If you have the contract source code, you can deploy it in a test environment and debug it using a tool like REMIX debugger.

Another approach is to use debug API or trace API if they are available on your node. They return the execution logs for your transaction on EVM. These two APIs are available on Chainstack at a cost.

Happy coding!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.