Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom error messages as a third parameter to SafeMath functions #1827

Closed
elch-yan opened this issue Jul 20, 2019 · 1 comment · Fixed by #1828
Closed

Custom error messages as a third parameter to SafeMath functions #1827

elch-yan opened this issue Jul 20, 2019 · 1 comment · Fixed by #1828

Comments

@elch-yan
Copy link
Contributor

elch-yan commented Jul 20, 2019

🧐 Motivation
It would be nice to have an option to add custom error message as a 3rd parameter to SafeMath contract functions.

📝 Details
One such example where it would be convenient is this:
uint256 finalFund = funds[msg.sender].sub(amount, "No enough funds!");

@nventuro
Copy link
Contributor

Hey there @elch-yan, thanks for this!

I've been thinking about this very feature for some time now, it's great to see that more people also consider it useful. Many people drop SafeMath checks in order to get a custom error message, so providing a way to do this makes a lot of sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants