Skip to main content

rok_core/
lib.rs

1//! Core error types for the rok ecosystem.
2//!
3//! Consolidates [`RokError`] (unified application error) and [`Problem`]
4//! (RFC 9457 problem details) into a single crate. The original `rok-error`
5//! and `rok-problem` crates are kept as deprecated shim re-exports.
6//!
7//! # Feature flags
8//!
9//! | Feature | Enables |
10//! |---------|---------|
11//! | `axum`  | `IntoResponse` for `RokError` and `Problem` |
12//!
13//! # Example
14//!
15//! ```rust,ignore
16//! use rok_core::{RokError, Problem};
17//! use axum::{Json, extract::Path};
18//!
19//! async fn get_user(Path(id): Path<i64>) -> Result<Json<User>, RokError> {
20//!     let user = User::find_or_fail(&pool, id).await?;
21//!     Ok(Json(user))
22//! }
23//! ```
24
25pub mod error;
26
27#[cfg(feature = "debug")]
28pub mod debug;
29
30#[cfg(feature = "app")]
31pub mod app;
32
33pub mod problem;
34
35pub use error::{RokError, RokException};
36pub use problem::Problem;
37
38#[cfg(feature = "named-routes")]
39pub mod named_routes;
40
41#[cfg(feature = "named-routes")]
42pub mod url;
43
44#[cfg(feature = "i18n")]
45pub mod i18n;
46
47#[cfg(feature = "config")]
48pub mod config;
49
50pub mod pipeline;
51
52#[cfg(feature = "collection")]
53pub mod collection;
54#[cfg(feature = "collection")]
55pub use collection::RokCollection;
56
57#[cfg(feature = "container")]
58pub mod container;
59
60#[cfg(feature = "crypto")]
61pub mod crypto;
62
63#[cfg(feature = "api")]
64pub mod api;
65#[cfg(feature = "api")]
66pub use api::{ApiResponse, PaginationMeta};
67
68#[cfg(feature = "api")]
69pub mod hooks;