massa_execution_exports/
error.rs

1// Copyright (c) 2022 MASSA LABS <info@massa.net>
2
3//! this file defines all possible execution error categories
4
5use displaydoc::Display;
6use massa_module_cache::error::CacheError;
7use massa_sc_runtime::VMError;
8use massa_versioning::versioning_factory::FactoryError;
9use thiserror::Error;
10
11/// Errors of the execution component.
12#[non_exhaustive]
13#[derive(Clone, Display, Error, Debug)]
14pub enum ExecutionError {
15    /// Channel error
16    ChannelError(String),
17
18    /// Runtime error: {0}
19    RuntimeError(String),
20
21    /// `MassaHashError`: {0}
22    MassaHashError(#[from] massa_hash::MassaHashError),
23
24    /// `ModelsError`: {0}
25    ModelsError(#[from] massa_models::error::ModelsError),
26
27    /// `RollBuy` error: {0}
28    RollBuyError(String),
29
30    /// `RollSell` error: {0}
31    RollSellError(String),
32
33    /// Slash roll or deferred credits  error: {0}
34    SlashError(String),
35
36    /// `Transaction` error: {0}
37    TransactionError(String),
38
39    /// Block gas error: {0}
40    BlockGasError(String),
41
42    /// Invalid slot range
43    InvalidSlotRange,
44
45    /// Not enough gas in the block: {0}
46    NotEnoughGas(String),
47
48    /// Given gas is above the threshold: {0}
49    TooMuchGas(String),
50
51    /// Include operation error: {0}
52    IncludeOperationError(String),
53
54    /// Include denunciation error: {0}
55    IncludeDenunciationError(String),
56
57    /// VM Error in {context} context: {error}
58    VMError {
59        /// execution context in which the error happened
60        context: String,
61        /// `massa-sc-runtime` virtual machine error
62        error: VMError,
63    },
64
65    /// Cache error: {0}
66    CacheError(#[from] CacheError),
67
68    /// Factory error: {0}
69    FactoryError(#[from] FactoryError),
70
71    /// Autonomous smart contract call error: {0}
72    DeferredCallsError(String),
73}
74
75/// Execution query errors
76#[derive(Clone, Display, Error, Debug)]
77pub enum ExecutionQueryError {
78    /// Not found: {0}
79    NotFound(String),
80    /// Cumulative response size limit exceeded: {0}
81    TooLargeResponse(String),
82}