1use std::fmt;
2
3#[derive(Debug)]
5pub enum AgentError {
6 Vault(String),
8 Identity(String),
10 Transport(String),
12 Refused(String),
14 Protocol(String),
16 Store(String),
18 Ingest(String),
20 NeedsInvite,
22}
23
24impl fmt::Display for AgentError {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 match self {
27 Self::Vault(m) => write!(f, "vault: {m}"),
28 Self::Identity(m) => write!(f, "identity: {m}"),
29 Self::Transport(m) => write!(f, "transport: {m}"),
30 Self::Refused(m) => write!(f, "refused: {m}"),
31 Self::Protocol(m) => write!(f, "protocol: {m}"),
32 Self::Store(m) => write!(f, "store: {m}"),
33 Self::Ingest(m) => write!(f, "ingest: {m}"),
34 Self::NeedsInvite => write!(f, "this identity is not enrolled yet: the operator must give an invite"),
35 }
36 }
37}
38
39impl std::error::Error for AgentError {}
40
41pub type Result<T> = std::result::Result<T, AgentError>;