-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the feature
I haven't found any solution for this problem using hardhat. So, if there is actually already a solution for this, I'd be delighted to get to know it.
Problem
I'm using mainly custom errors in my contracts and many of them are used in multiple places in a contract. When I'm testing the contract for these errors, I need to write down the custom error as a string every time. I can define constant values for each custom error that defines that string value, but it's not so nice to have to do that for each custom error.
So, for the following error:
error NoAuthorization();I need to use the string "NoAuthorization" whenever I test this error occurrence:
await expect(myContract.connect(sender).pause()).to.be.revertedWithCustomError(myContract, "NoAuthorization");Feature Request
I'd like to have access to a selector or some sort of reference of the custom errors of my contracts, so that I don't need to use a string value for them. This could look something similar to the following:
await expect(myContract.connect(sender).pause()).to.be.revertedWithCustomError(myContract.NoAuthorization);Related to #3486
Search terms
Custom Error
Metadata
Metadata
Assignees
Labels
Type
Projects
Status