Skip to content

Instantly share code, notes, and snippets.

@AyDeveloper
Last active August 16, 2022 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AyDeveloper/4daa4272db40401150737b36e82c2c3a to your computer and use it in GitHub Desktop.
Save AyDeveloper/4daa4272db40401150737b36e82c2c3a to your computer and use it in GitHub Desktop.
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