pub type ApiResult<T = ()> = Result<T, Problem>;Expand description
Standard result type for API operations
Use this throughout your handlers for consistent error handling:
ⓘ
async fn handler() -> ApiResult<Json<User>> {
let user = fetch_user().await?; // auto-converts errors to Problem
Ok(Json(user))
}The ? operator automatically converts any error implementing
Into<Problem> (including modkit_odata::Error) into a Problem.
Problem implements IntoResponse, so Axum will automatically convert it
to an HTTP response when returned from a handler.
Aliased Type§
pub enum ApiResult<T = ()> {
Ok(T),
Err(Problem),
}