synapse-waf 0.9.1

High-performance WAF and reverse proxy with embedded intelligence — built on Cloudflare Pingora
Documentation
//! Error types for Signal Horizon integration.

use thiserror::Error;

/// Errors from the Horizon client.
#[derive(Debug, Error)]
pub enum HorizonError {
    /// Configuration error
    #[error("Configuration error: {0}")]
    ConfigError(String),

    /// Connection failed
    #[error("Connection failed: {0}")]
    ConnectionFailed(String),

    /// Authentication failed
    #[error("Authentication failed: {0}")]
    AuthFailed(String),

    /// Send failed
    #[error("Send failed: {0}")]
    SendFailed(String),

    /// WebSocket error
    #[error("WebSocket error: {0}")]
    WebSocket(String),

    /// Serialization error
    #[error("Serialization error: {0}")]
    Serialization(String),

    /// Deserialization error
    #[error("Deserialization error: {0}")]
    Deserialization(String),

    /// Timeout
    #[error("Timeout: {0}")]
    Timeout(String),

    /// Not connected
    #[error("Not connected")]
    NotConnected,

    /// Already connected
    #[error("Already connected")]
    AlreadyConnected,
}

impl From<serde_json::Error> for HorizonError {
    fn from(e: serde_json::Error) -> Self {
        HorizonError::Serialization(e.to_string())
    }
}

impl From<tokio_tungstenite::tungstenite::Error> for HorizonError {
    fn from(e: tokio_tungstenite::tungstenite::Error) -> Self {
        HorizonError::WebSocket(e.to_string())
    }
}