tap_node/
error.rs

1//! Error handling for TAP Node
2
3use thiserror::Error;
4
5/// Error types for TAP Node
6#[derive(Error, Debug)]
7pub enum Error {
8    /// Agent not found
9    #[error("Agent not found: {0}")]
10    AgentNotFound(String),
11
12    /// Agent registration error
13    #[error("Agent registration error: {0}")]
14    AgentRegistration(String),
15
16    /// Invalid TAP message
17    #[error("Invalid TAP message: {0}")]
18    InvalidPlainMessage(String),
19
20    /// Error from agent
21    #[error("Agent error: {0}")]
22    Agent(String),
23
24    /// Serialization error
25    #[error("Serialization error: {0}")]
26    Serialization(String),
27
28    /// PlainMessage dispatch error
29    #[error("PlainMessage dispatch error: {0}")]
30    Dispatch(String),
31
32    /// PlainMessage processing error
33    #[error("PlainMessage processing error: {0}")]
34    Processing(String),
35
36    /// PlainMessage routing error
37    #[error("PlainMessage routing error: {0}")]
38    Routing(String),
39
40    /// Resolver error
41    #[error("Resolver error: {0}")]
42    Resolver(String),
43
44    /// DID resolution error
45    #[error("DID resolution error: {0}")]
46    DidResolution(String),
47
48    /// Configuration error
49    #[error("Configuration error: {0}")]
50    Configuration(String),
51
52    /// Message dropped during processing
53    #[error("Message dropped: {0}")]
54    MessageDropped(String),
55
56    /// Storage error
57    #[error("Storage error: {0}")]
58    Storage(String),
59
60    /// Verification error
61    #[error("Verification error: {0}")]
62    Verification(String),
63
64    /// Validation error
65    #[error("Validation error: {0}")]
66    Validation(String),
67}
68
69/// Result type for TAP Node
70pub type Result<T> = std::result::Result<T, Error>;
71
72/// Convert from tap_agent::Error to Error
73impl From<tap_agent::Error> for Error {
74    fn from(err: tap_agent::Error) -> Self {
75        Error::Agent(err.to_string())
76    }
77}