I'm a bit new to Solidity and am wondering if it's possible to throw an error without actually reverting? for example something along the lines of:

error NotEnoughBalance();
function notify(uint256 amount) override external {
        if(amount < balance):
            throw NotEnoughBalance()

and leave it to the calling function to chose to revert? I thought something like:

require(amount < balance, NotEnoughBalance())

but this throws a TypeError: "TypeError: No matching declaration found after argument-dependent lookup."

Thanks for any advice!!


Your Answer

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

Browse other questions tagged or ask your own question.