Closed fubuloubu closed 1 year ago
To be specific, Solidity 0.8.4
introduced Custom Errors.
Alternative syntax:
with my_contract.CustomError(_, _, ..., _):
my_contract.call_that_raises_CustomError(...)
with my_contract.CustomError(some_value, _, ..., _):
my_contract.call_that_raises_CustomErrorWithArgs(...)
But the use of the wildcard _
might be complex
KISS - I would definitely go with version 1.
KISS - I would definitely go with version 1.
Yeah I agree, but I did like the ability to do with CustomErrorType: ...
which I think it's a bit nicer looking syntax
I see - maybe worth introducing an alias later?
@fubuloubu any progress/news on this?
@fubuloubu any progress/news on this?
Overview
Solidity v0.8.x series added a new type of item to the abi called custom errors: https://docs.soliditylang.org/en/v0.8.17/structure-of-a-contract.html#errors
We have support for parsing these errors from the ABI as of ethpm-types v0.2.1
The basic gist is that when a revert happens, Solidity will return abi-encoded dated corresponding to the error type with additional information about the error. Some of the built-in Solidity errors are as follows (it might be good to add an enum with these to
ape-ethereum
orape-solidity
):Specification
It would be nice to use these error types in tests w/
ape.reverts
. Some examples might include:Dependencies
n/a