Last active
August 16, 2022 17:55
-
-
Save AyDeveloper/4daa4272db40401150737b36e82c2c3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract CustomError { | |
error InsufficientBalance(uint balance, uint withdrawAmount); | |
function testCustomError(uint _withdrawAmount) public view { | |
uint bal = address(this).balance; | |
if (bal < _withdrawAmount) { | |
revert InsufficientBalance({balance: bal, withdrawAmount: _withdrawAmount}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment