Skip to main content

Crate rskit_errors

Crate rskit_errors 

Source
Expand description

Structured application error types with HTTP status mapping.

§Examples

use rskit_errors::{AppError, AppResult, ErrorCode};

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

let err = find_user("abc").unwrap_err();
assert_eq!(err.code(), ErrorCode::NotFound);
assert!(err.message().contains("find_user"));

Re-exports§

pub use code::ErrorCode;
pub use error::AppError;
pub use response::ProblemDetail;
pub use response::type_base_uri;

Modules§

code
Machine-readable error classification codes.
convert
Conversions between AppError and HTTP status types.
error
Structured AppError type with rich context.
response
RFC 9457 Problem Details response type.

Type Aliases§

AppResult
Convenience alias used throughout rskit crates.