multiversx_sc_scenario::debug_executor

Function catch_tx_panic

Source
pub fn catch_tx_panic<F>(panic_message_flag: bool, f: F) -> Result<(), TxPanic>
where F: FnOnce() -> Result<(), TxPanic>,
Expand description

Catches all thrown panics, as follows:

  • BreakpointValue is considered expected abortion of execution and already handled, for them it returns Ok;
  • TxPanic panics are considered VM failures with additional information. We are trying to get rid of them;
  • All other panics are treated as user errors;
  • The closure argument can also opt to return a TxPanic, without having to throw it. This will pe passed on as is.