rskit-errors 0.2.0-alpha.1

Structured application error types with HTTP status mapping
Documentation

rskit-errors — Structured Error Types

AppError + ErrorCode enum + AppResult<T> with RFC 9457 problem details and lightweight HTTP status metadata.

CI crates.io docs.rs License: MIT MSRV: 1.91

Features

  • 18 ErrorCode variants covering common application error scenarios
  • Fluent builder with with_detail / with_cause
  • Automatic HTTP status metadata via http_status()
  • Retryability query via is_retryable()

rskit-errors intentionally depends only on lightweight shared protocol/data crates such as http, serde, and serde_json. Transport-specific conversions live in transport crates; for example, tonic::Status mapping belongs to rskit-grpc.

Usage

[dependencies]
rskit-errors = "0.2.0-alpha.1"
use rskit_errors::{AppError, ErrorCode, AppResult};

fn find_user(id: &str) -> AppResult<String> {
    Err(AppError::not_found("user", id)
        .with_detail("tenant", "acme"))
}

let err = find_user("99").unwrap_err();
assert_eq!(err.code, ErrorCode::NotFound);
assert_eq!(err.http_status(), 404);

See Also

Main repository README