1use std::fmt;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub enum Error {
5 InvalidId(String),
6 InvalidKind(String),
7 InvalidUrl(String),
8 InvalidMessageId(String),
9 InvalidBody(String),
10 NotFound(String),
11 Frozen(String),
12 Tombstoned(String),
13 Evidence(String),
14 Io(String),
15 Decode(String),
16}
17
18impl fmt::Display for Error {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 match self {
21 Self::InvalidId(s) => write!(f, "invalid deed id: {s}"),
22 Self::InvalidKind(s) => write!(f, "invalid kind: {s}"),
23 Self::InvalidUrl(s) => write!(f, "invalid url: {s}"),
24 Self::InvalidMessageId(s) => write!(f, "invalid message-id: {s}"),
25 Self::InvalidBody(s) => write!(f, "invalid body: {s}"),
26 Self::NotFound(s) => write!(f, "deed not found: {s}"),
27 Self::Frozen(s) => write!(f, "deed frozen: {s}"),
28 Self::Tombstoned(s) => write!(f, "deed tombstoned: {s}"),
29 Self::Evidence(s) => write!(f, "evidence: {s}"),
30 Self::Io(s) => write!(f, "store io: {s}"),
31 Self::Decode(s) => write!(f, "store decode: {s}"),
32 }
33 }
34}
35
36impl std::error::Error for Error {}
37
38pub type Result<T> = std::result::Result<T, Error>;