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
use anomaly::{BoxError, Context};
use thiserror::Error;
pub type Error = anomaly::Error<Kind>;
#[derive(Clone, Debug, Error)]
pub enum Kind {
#[error("error converting message type into domain type")]
TryFromProtobuf,
#[error("error encoding message into buffer")]
EncodeMessage,
#[error("error decoding buffer into message")]
DecodeMessage,
}
impl Kind {
pub fn context(self, source: impl Into<BoxError>) -> Context<Self> {
Context::new(self, Some(source.into()))
}
}