wireband-edge 0.2.0

Lightweight Wire.Band client for IoT gateway hardware — Raspberry Pi, NVIDIA Jetson, industrial PCs
Documentation
use thiserror::Error;

#[derive(Debug, Error)]
pub enum WireBandError {
    #[error("HTTP request failed: {0}")]
    Http(#[from] reqwest::Error),

    #[error("JSON error: {0}")]
    Json(#[from] serde_json::Error),

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

    #[error("Frame too short (len={0}, need ≥2)")]
    FrameTooShort(usize),

    #[error("Frame payload is not valid UTF-8: {0}")]
    FrameEncoding(#[from] std::str::Utf8Error),

    #[cfg(feature = "mqtt")]
    #[error("MQTT error: {0}")]
    Mqtt(String),

    #[cfg(feature = "modbus")]
    #[error("Modbus error: {0}")]
    Modbus(String),

    #[cfg(feature = "serial")]
    #[error("Serial error: {0}")]
    Serial(String),

    #[cfg(feature = "ble")]
    #[error("BLE error: {0}")]
    Ble(String),

    #[cfg(feature = "coap")]
    #[error("CoAP error: {0}")]
    Coap(String),
}

pub type Result<T> = std::result::Result<T, WireBandError>;