//! Error types for `quicprochat-core`. use thiserror::Error; /// Errors produced by core cryptographic and MLS operations. #[derive(Debug, Error)] pub enum CoreError { /// Cap'n Proto serialisation or deserialisation failed. #[cfg(feature = "native")] #[error("Cap'n Proto error: {0}")] Capnp(#[from] capnp::Error), /// An MLS operation failed (string description). /// /// Preserved for backward compatibility. Prefer [`CoreError::MlsError`] /// for new code that wraps typed openmls errors. #[error("MLS error: {0}")] Mls(String), /// An MLS operation failed (typed, boxed error). /// /// Wraps the underlying openmls error so callers can downcast to specific /// error types when needed. #[error("MLS error: {0}")] MlsError(Box), /// A hybrid KEM (X25519 + ML-KEM-768) operation failed. #[error("hybrid KEM error: {0}")] HybridKem(#[from] crate::hybrid_kem::HybridKemError), /// IO or persistence failure. #[error("io error: {0}")] Io(String), /// Application message (rich payload) parse or serialisation error. #[error("app message: {0}")] AppMessage(String), }