I am using Brownie to develop my smart contracts, which helps me to intract with the smart contracts, please see doc.
When my call Example.greet()
is there any way to return the error message and act based on it during my tests? Also find out is it reverted because the transaction is out of gas or not.
Similar question is answered for Truffle: [how to catch “revert” error in truffle test javascript?].
Example of a simple contract with a revert()
message:
contract Example{
function greet(){
revert("Hello World");
}
}
deployed
in the 3rd line toinvoked
:)