Skip to main content

oxide_mesh/
error.rs

1//! Error type.
2
3use thiserror::Error;
4
5/// All errors produced by the mesh.
6#[derive(Debug, Error)]
7pub enum MeshError {
8    /// I/O failure (TCP transport).
9    #[error("io error: {0}")]
10    Io(#[from] std::io::Error),
11
12    /// JSON (de)serialization.
13    #[error("json error: {0}")]
14    Json(#[from] serde_json::Error),
15
16    /// Peer was not found in the local registry.
17    #[error("unknown peer `{0}`")]
18    UnknownPeer(String),
19
20    /// Wrapped kernel error.
21    #[error("kernel error: {0}")]
22    Kernel(#[from] oxide_k::KernelError),
23
24    /// Catch-all.
25    #[error(transparent)]
26    Other(#[from] anyhow::Error),
27}
28
29/// Convenience alias.
30pub type Result<T> = std::result::Result<T, MeshError>;