Skip to main content

Crate rok_core

Crate rok_core 

Source
Expand description

Core error types for the rok ecosystem.

Consolidates RokError (unified application error) and Problem (RFC 9457 problem details) into a single crate. The original rok-error and rok-problem crates are kept as deprecated shim re-exports.

§Feature flags

FeatureEnables
axumIntoResponse for RokError and Problem

§Example

use rok_core::{RokError, Problem};
use axum::{Json, extract::Path};

async fn get_user(Path(id): Path<i64>) -> Result<Json<User>, RokError> {
    let user = User::find_or_fail(&pool, id).await?;
    Ok(Json(user))
}

Re-exports§

pub use error::RokError;
pub use error::RokException;
pub use problem::Problem;

Modules§

error
pipeline
problem
RFC 9457 — Problem Details for HTTP APIs.

Macros§

rok_exception
Define a typed exception struct implementing RokException.