Solidity – Is There a Way to Handle abi.decode Errors with Hardhat?

custom-errorshardhatrequirerevertsolidity

I am trying to decode a bytes value, and while writing tests, I was trying to pass invalid values to force an error.
Although I get the error missing revert data in call exception, I cannot find a way to revert with a custom error/string.

Best Answer

While writing the question, I was able to find a solution. ATTOW this is already a feature request. See issue-10381 and issue-10933 on github. Thankfully one of the core members mentioned in this comment that this feature is on the roadmap.

If you're reading this in the future, please leave an updated answer.

Related Topic