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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
use super::Stream;
use crate::execution_step::Generation;
use crate::ToErrorCode;
use air_interpreter_cid::CidCalculationError;
use air_interpreter_data::ValueRef;
use air_trace_handler::GenerationCompatificationError;
use air_trace_handler::TraceHandlerError;
use strum::IntoEnumIterator;
use strum_macros::EnumDiscriminants;
use strum_macros::EnumIter;
use thiserror::Error as ThisError;
#[derive(ThisError, EnumDiscriminants, Debug)]
#[strum_discriminants(derive(EnumIter))]
pub enum UncatchableError {
#[error("on instruction '{instruction}' trace handler encountered an error: {trace_error}")]
TraceError {
trace_error: TraceHandlerError,
instruction: String,
},
#[error(transparent)]
GenerationCompatificationError(#[from] GenerationCompatificationError),
#[error("fold state not found for this iterable '{0}'")]
FoldStateNotFound(String),
#[error("variable with name '{0}' can't be shadowed, shadowing isn't supported for iterables")]
IterableShadowing(String),
#[error("multiple iterable values found for iterable name '{0}'")]
MultipleIterableValues(String),
#[error("call result value {0:?} doesn't match with corresponding instruction")]
CallResultNotCorrespondToInstr(ValueRef),
#[error("trying to shadow variable '{0}', but shadowing is allowed only inside fold blocks")]
ShadowingIsNotAllowed(String),
#[error("new end block tries to pop up a variable '{scalar_name}' that wasn't defined at depth {depth}")]
ScalarsStateCorrupted { scalar_name: String, depth: usize },
#[error("failed to calculate value's CID")]
CidError(#[from] CidCalculationError),
#[error("{0} for CID {1:?} not found")]
ValueForCidNotFound(&'static str, String),
#[error(
"stream doesn't have generation with number {generation}, supplied to the interpreter data is corrupted,\n\
stream is {stream:?}"
)]
StreamDontHaveSuchGeneration { stream: Stream, generation: Generation },
#[error("failed to deserialize to CallServiceFailed: {0}")]
MalformedCallServiceFailed(serde_json::Error),
}
impl ToErrorCode for UncatchableError {
fn to_error_code(&self) -> i64 {
use crate::utils::UNCATCHABLE_ERRORS_START_ID;
crate::generate_to_error_code!(self, UncatchableError, UNCATCHABLE_ERRORS_START_ID)
}
}