zephyr_vm/
error.rs

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use thiserror::Error;

#[derive(Error, Debug)]
pub enum InternalError {
    #[error("Faulty wasmi configuration")]
    WasmiConfig,

    #[error("Error while performing arithmetic calc")]
    ArithError,

    #[error("Cannot upgrade weak to rc")]
    CannotUpgradeRc,
}

#[derive(Error, Debug)]
pub enum HostError {
    #[error("Binary does not export Zephyr entry function")]
    NoEntryPointExport,

    #[error("Extern is not a function")]
    ExternNotAFunction,

    #[error("Tried loading contex where context already exists")]
    ContextAlreadyExists,

    #[error("Tried using VM contex where none exists")]
    NoContext,

    #[error("Zephyr cannot operate without memory export")]
    NoMemoryExport,

    #[error("Tried reading stack at an index where no value is on it")]
    NoValOnStack,

    #[error("Tried overwriting ledger close meta")]
    LedgerCloseMetaOverridden,

    #[error("Requested ledger close meta but it is none")]
    NoLedgerCloseMeta,

    #[error("Requested ledger entry doesn't exist")]
    NoLedgerEntry,

    #[error("Invalid types found on function result")]
    InvalidFunctionResult,

    #[error("Tried using the transmitter but didn't provide one")]
    NoTransmitter,

    #[error("Internal Error")]
    InternalError(InternalError),

    #[error("Error on the Soroban host side")]
    SorobanHost,
}