why .revertedWith("') is Not working for custom errors as shown in video #2343
-
why .revertedWith("') is Not working for custom errors as shown in video In my test script the following revertWith code is not working for custom errors await expect(attackerConnectedContract.withdraw()).to.be.revertedWith("FundMe__NotOwner");```
in My solidity FundMe contract:
```solidity
error FundMe__NotOwner();
modifier Onlyyowner() {
if (msg.sender != owner) revert FundMe__NotOwner();
_;
} but when I am using the following code its's working perfectly, But my question is why it worked in the video but not in my code ?? await expect(attackerConnectedContract.withdraw()).to.be.revertedWithCustomError(fundMe, "FundMe__NotOwner"); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@OmarWaqar123 The version of dependencies that Patrick had used in the video has been updated and the code too. |
Beta Was this translation helpful? Give feedback.
-
It was updated to account for explicitly calling custom errors; thereby making the statement |
Beta Was this translation helpful? Give feedback.
@OmarWaqar123 The version of dependencies that Patrick had used in the video has been updated and the code too.