Skip to main content
added 9 characters in body; edited tags
Source Link
Shane Fontaine
  • 18.3k
  • 20
  • 56
  • 83

In my contract, I have a bunch of checking at the start of a public function,. It looks something like this:

require ( prx < 1e18, "Value prx too high")
require ( prx != 0, "Value prx cannot be zero")
if (!validAmt(amt)) { revert("Value amt invalid"); }

Obviously I would like the user to see the failure and the reason text, is this possible in web3.js, or perhaps web3.py?

I know I can capture events, but I don't want to log events on these kind of failures.

In my contract I have a bunch of checking at the start of a public function, something like this:

require ( prx < 1e18, "Value prx too high")
require ( prx != 0, "Value prx cannot be zero")
if (!validAmt(amt)) { revert("Value amt invalid"); }

Obviously I would like the user to see the failure and the reason text, is this possible in web3.js or perhaps web3.py?

I know I can capture events, but I don't want to log events on these kind of failures.

In my contract, I have a bunch of checking at the start of a public function. It looks something like this:

require ( prx < 1e18, "Value prx too high")
require ( prx != 0, "Value prx cannot be zero")
if (!validAmt(amt)) { revert("Value amt invalid"); }

Obviously I would like the user to see the failure and the reason text, is this possible in web3.js, or perhaps web3.py?

I know I can capture events, but I don't want to log events on these kind of failures.

Source Link

Is there a way to capture the require / revert failure reason?

In my contract I have a bunch of checking at the start of a public function, something like this:

require ( prx < 1e18, "Value prx too high")
require ( prx != 0, "Value prx cannot be zero")
if (!validAmt(amt)) { revert("Value amt invalid"); }

Obviously I would like the user to see the failure and the reason text, is this possible in web3.js or perhaps web3.py?

I know I can capture events, but I don't want to log events on these kind of failures.