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    InvalidMessage(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(serde_json::Error),
27
28    /// Message dispatch error
29    #[error("Message dispatch error: {0}")]
30    Dispatch(String),
31
32    /// Message processing error
33    #[error("Message processing error: {0}")]
34    Processing(String),
35
36    /// Message routing error
37    #[error("Message 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
53/// Result type for TAP Node
54pub type Result<T> = std::result::Result<T, Error>;
55
56/// Convert from tap_agent::Error to Error
57impl From<tap_agent::Error> for Error {
58    fn from(err: tap_agent::Error) -> Self {
59        Error::Agent(err.to_string())
60    }
61}