slave-framework 0.13.1

Runtime for slave apps (a Laravel-inspired Rust framework for MCP-first apps): server lifecycle, config, logging, a SurrealDB database with SurrealQL migrations, and OpenID Connect sign-in
Documentation
use std::io;

/// Errors raised by the slave runtime.
#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error("failed to load .env file: {0}")]
    Dotenv(#[from] dotenvy::Error),

    #[error("invalid value {value:?} for environment variable {key}: {reason}")]
    InvalidEnv {
        key: String,
        value: String,
        reason: String,
    },

    #[error("failed to initialize logging: {0}")]
    Logging(String),

    #[error("failed to bind to {addr}: {source}")]
    Bind {
        addr: String,
        #[source]
        source: io::Error,
    },

    #[error("server error: {0}")]
    Server(#[source] io::Error),

    /// A sign-in that cannot go ahead, worded for the user (e.g. a wrong
    /// email address, or too many codes).
    #[cfg(feature = "auth")]
    #[error("{0}")]
    Auth(String),

    #[cfg(feature = "auth")]
    #[error("sign-in setup: {0}")]
    AuthSetup(String),

    #[cfg(feature = "database")]
    #[error("database error: {0}")]
    Database(#[from] surrealdb::Error),

    #[cfg(feature = "database")]
    #[error("{0} is not set")]
    MissingDatabaseSetting(&'static str),

    #[cfg(feature = "database")]
    #[error("migration failed: {0}")]
    Migration(String),
}

/// Shorthand for results returned by the slave runtime.
pub type Result<T, E = Error> = std::result::Result<T, E>;