baichun-framework-core 0.1.0

Core module for Baichun-Rust framework
Documentation
use thiserror::Error;

/// 框架核心错误类型
#[derive(Debug, Error)]
pub enum Error {
    #[error("IO错误: {0}")]
    Io(#[from] std::io::Error),

    #[error("序列化错误: {0}")]
    Serialization(#[from] serde_json::Error),

    #[error("验证错误: {0}")]
    Validation(String),

    #[error("认证错误: {0}")]
    Authentication(String),

    #[error("授权错误: {0}")]
    Authorization(String),

    #[error("业务错误: {0}")]
    Business(String),

    #[error("系统错误: {0}")]
    System(String),

    #[error("未知错误: {0}")]
    Unknown(String),
}

/// 框架结果类型
pub type Result<T> = std::result::Result<T, Error>;