use fuel_types::ContractId;
pub struct Panic {
    pub contract_id: ContractId, 
    pub reason: u32, 
  • A Panic receipt is produced when a Sway smart contract call fails for a reason that doesn't produce a revert.
  • The reason field records the reason for the panic, which is represented by a number between 0 and 255. You can find the mapping between the values and their meanings here in the FuelVM source code.
  • Read more about Panic in the Fuel Protocol spec
  • You can handle functions that could produce a Panic receipt by adding a parameter with the type Panic.
fn handle_panic(panic: Panic) {
  // handle the emitted Panic receipt