nysiris_core/error.rs
1/// Errors shared by the Nysiris native core.
2#[derive(Debug, thiserror::Error)]
3pub enum CoreError {
4 /// A key, public point, or secret is malformed.
5 #[error("invalid key: {0}")]
6 InvalidKey(String),
7 /// Input failed validation (size limits, addressing, unknown member).
8 #[error("invalid input: {0}")]
9 InvalidInput(String),
10 /// Encryption, decryption, or signature verification failed.
11 #[error("cryptographic failure: {0}")]
12 Crypto(String),
13 /// Local filesystem failure.
14 #[error("io failure: {0}")]
15 Io(#[from] std::io::Error),
16 /// Envelope or journal serialization failure.
17 #[error("json failure: {0}")]
18 Json(#[from] serde_json::Error),
19 /// The transport refused or failed to deliver a payload.
20 #[error("transport failure: {0}")]
21 Transport(String),
22 /// A contact, room, or other referenced item is not present locally.
23 #[error("not found: {0}")]
24 NotFound(String),
25 /// A history journal is missing, truncated, tampered with, or unreadable.
26 #[error("history failure: {0}")]
27 History(String),
28}
29
30/// Convenience alias for results produced by this crate.
31pub type Result<T> = std::result::Result<T, CoreError>;