rocket_errors/lib.rs
1//! This crate provides a wrapper of `anyhow::Error` and `eyre::Report` to be able to make use of
2//! them in Rocket framework.
3
4//! # Example
5//! ```rust
6//! // An example usage of `rocket_errors::anyhow::Result`.
7//! use rocket::{get, routes};
8//! use rocket_errors::anyhow;
9//!
10//! #[get("/")]
11//! pub fn health_check() -> anyhow::Result<&'static str> {
12//! Ok("Hello, world!")
13//! }
14//!
15//! #[rocket::main]
16//! async fn main() -> anyhow::Result<()> {
17//! let _ = rocket::build()
18//! .mount("/hc", routes![health_check])
19//! .launch()
20//! .await?;
21//! Ok(())
22//! }
23//! ````
24
25#[cfg(not(feature = "eyre"))]
26pub mod anyhow;
27#[cfg(feature = "eyre")]
28pub mod eyre;