1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#[derive(Copy, Clone, Debug)]
#[repr(u8)]
pub enum ExecuteError {
    Generic = 1,
    Bounds,
    Unreachable,
    IllegalOpcode,
    InvalidNativeInvoke,
    NotSupported,
    InvalidInput,
    ExecutionLimit,
    MemoryLimit,
    SlotLimit,
    FatalSignal,
    Fuse,
    DivideByZero
}

pub type ExecuteResult<T> = Result<T, ExecuteError>;

impl ExecuteError {
    pub fn status(&self) -> i32 {
        -(*self as u8 as i32)
    }
}