Build with GenLayer
Error Handling

Error handling

Sometimes contracts can produce errors. There are two kinds of errors in GenVM:

  • unrecoverable errors
  • rollbacks

If a non-deterministic block or contract call produces an unrecoverable error, it will terminate your contract execution. Unrecoverable errors include:

  • exit(x) where x≠0x \neq 0
  • unhandled Exception

And a recoverable error via one of two mechanisms:

  • raise Rollback("message")
  • gl.rollback_immediate("message")

Later method won't unwind stack and current VM can't catch it

Built-in gl.eq_principle_* functions family will raise Rollback(sub_vm_message) in case non-deterministic block agreed on a rollback. Note that rollback message is compared for strict equality