rframe 0.1.1

A lightweight framework implemented in Rust
Documentation
use thiserror::Error;

#[derive(Error, Debug)]
pub enum Error {
    #[error("数据库错误: {0}")]
    #[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
    Database(#[from] sqlx::Error),

    #[error("Redis错误: {0}")]
    #[cfg(any(
        feature = "cache-redis",
        feature = "cache-local",
        feature = "cache-multilevel",
    ))]
    Redis(#[from] redis::RedisError),

    #[error("配置错误: {0}")]
    Config(String),

    #[error("查询错误: {0}")]
    Query(String),

    #[error("连接池错误: {0}")]
    Pool(String),

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

    #[error("其他错误: {0}")]
    Other(String),
}

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