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
use anomaly::BoxError;
use anomaly::Context;
use tendermint::block::Height;
use tendermint::Hash;
use thiserror::Error;
use crate::components::io::IoError;
pub type Error = anomaly::Error<Kind>;
#[derive(Debug, Clone, Error, PartialEq)]
pub enum Kind {
#[error("I/O error: {0}")]
Io(#[from] IoError),
#[error("height mismatch: given = {given}, found = {found}")]
HeightMismatch {
given: Height,
found: Height,
},
#[error("hash mismatch: given = {given}, found = {found}")]
HashMismatch {
given: Hash,
found: Hash,
},
#[error("invalid light block")]
InvalidLightBlock,
#[error("no trusted state in store")]
NoTrustedStateInStore,
#[error("empty witness list")]
EmptyWitnessList,
}
impl Kind {
pub fn context(self, source: impl Into<BoxError>) -> Context<Self> {
Context::new(self, Some(source.into()))
}
}