Skip to main content

Crate pleme_error

Crate pleme_error 

Source
Expand description

§pleme-error

Unified error handling library for Pleme platform services.

§Philosophy

This library implements Railway-Oriented Programming (Scott Wlaschin) principles:

  • Errors are first-class citizens
  • Railway tracks: success path vs error path
  • Composable error handling

§Usage

use pleme_error::{ServiceError, Result};

fn get_user(id: &str) -> Result<User> {
    let user = db.find(id)
        .map_err(|e| ServiceError::database("User not found", e))?;
    Ok(user)
}

§Features

  • context - Error context and chaining with anyhow
  • graphql - GraphQL error conversion for async-graphql
  • http-errors - HTTP status code conversion for Axum
  • logging - Structured error logging with tracing
  • database - Database error conversions (sqlx, Redis)
  • web - Full web stack (graphql + http-errors + logging)
  • full - All features enabled

Re-exports§

pub use field_validator::FieldValidator;
pub use field_validator::validation_errors_from_fields;
pub use field_validator::validation_from_fields;

Modules§

field_validator
Multi-field validation error collection and aggregation

Enums§

ServiceError
Unified error type for Pleme services

Type Aliases§

Result
Result type alias for Railway-Oriented Programming