mzrs-sdk 0.1.21

High-level Rust SDK for Mezon platform
Documentation
//! Error types for the SDK layer.
//!
//! [`SdkError`] wraps [`CoreError`](mzrs_core::CoreError) and adds
//! builder-specific and validation failure modes.

use thiserror::Error;

/// Errors that can occur within the SDK layer.
///
/// Each variant either wraps a lower-layer error or represents a condition
/// specific to builders, validation, or high-level API usage.
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum SdkError {
    /// An error propagated from the core layer.
    #[error(transparent)]
    Core(#[from] mzrs_core::CoreError),

    /// A builder was used incorrectly (e.g. missing required fields).
    #[error("builder error: {0}")]
    Builder(String),

    /// A value failed validation before being sent to the server.
    #[error("validation error: {0}")]
    Validation(String),

    /// An I/O error reading a file from disk.
    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),

    /// Invalid base64 input when decoding an [`AttachmentSource::Base64`].
    #[error("base64 decode error: {0}")]
    Base64(String),
}