contextvm-sdk 0.1.1

Rust SDK for the ContextVM protocol — MCP over Nostr
Documentation
//! Error types for the ContextVM SDK

/// Result type alias for ContextVM operations.
pub type Result<T> = std::result::Result<T, Error>;

/// Errors that can occur during ContextVM operations.
#[derive(Debug, thiserror::Error)]
pub enum Error {
    /// Transport-level error (relay connection, publishing, subscription)
    #[error("Transport error: {0}")]
    Transport(String),

    /// NIP-44 encryption error
    #[error("Encryption error: {0}")]
    Encryption(String),

    /// NIP-44 decryption error
    #[error("Decryption error: {0}")]
    Decryption(String),

    /// Request timed out waiting for response
    #[error("Request timed out")]
    Timeout,

    /// Message validation error (size, schema)
    #[error("Validation error: {0}")]
    Validation(String),

    /// Unauthorized request (pubkey not in allowlist)
    #[error("Unauthorized: {0}")]
    Unauthorized(String),

    /// Serialization/deserialization error
    #[error("Serialization error: {0}")]
    Serialization(#[from] serde_json::Error),

    /// Generic error
    #[error("{0}")]
    Other(String),
}