5

Is there any built-in way of catching throw clauses?

For example, if I'm building a voting application where people must be given permission by the chairperson before voting, otherwise the contract throws.

Would it be possible to catch this throw in order to give the user a feedback of what happened without having to manually trigger an event?

Henrique Barcelos
  • 2,481
  • 4
  • 20
  • 38

1 Answers1

3

No. Throw generates an invalid JUMP in the EVM causing immediate termination.

If you're building your own DApp, simply check for voting rights before trying to vote. It's simpler than handling exceptional cases.

Péter Szilágyi
  • 10,436
  • 39
  • 42