Skip to main content

huddle_protocol/
error.rs

1use thiserror::Error;
2
3/// Errors from the pure protocol/crypto layer — a deliberate subset of the
4/// client's `HuddleError` carrying only the variants the runtime-free
5/// constructions actually produce (no storage / io / network). `huddle-core`
6/// maps each of these to the matching `HuddleError` variant, so error kinds
7/// and text are preserved across the crate boundary.
8#[derive(Debug, Error)]
9pub enum ProtocolError {
10    #[error("identity error: {0}")]
11    Identity(String),
12
13    #[error("session error: {0}")]
14    Session(String),
15
16    #[error("serialization error: {0}")]
17    Serialization(#[from] serde_json::Error),
18
19    #[error("{0}")]
20    Other(String),
21}
22
23pub type Result<T> = std::result::Result<T, ProtocolError>;