1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! Styled error pages and dev-mode error badge overlay.
//!
//! Autumn provides default HTML error pages for common HTTP error codes
//! (404, 422, 500) and a Next.js-style error badge overlay in dev mode.
//!
//! # Error page override
//!
//! Implement [`ErrorPageRenderer`] to provide custom error pages:
//!
//! ```rust,no_run
//! use autumn_web::error_pages::{ErrorPageRenderer, ErrorContext};
//! use maud::{Markup, html};
//!
//! struct MyErrorPages;
//!
//! impl ErrorPageRenderer for MyErrorPages {
//! fn render_error(&self, ctx: &ErrorContext) -> Markup {
//! html! {
//! h1 { (ctx.status.as_u16()) " - " (ctx.path) }
//! }
//! }
//! }
//! ```
//!
//! Register it on the app builder:
//!
//! ```rust,ignore
//! autumn_web::app()
//! .error_pages(MyErrorPages)
//! .routes(routes![...])
//! .run()
//! .await;
//! ```
//!
//! # Dev error badge
//!
//! In dev profile, error responses automatically include a floating badge
//! in the bottom-left corner showing status code, error type, and message.
//! The badge uses inline CSS so it works even when Tailwind is unavailable.
//! It is **never** shown in production.
pub
pub
pub use DefaultErrorPages;
pub use ;
use StatusCode;
use Markup;
use Arc;
/// Render an error page using the given renderer (or defaults).
///
/// Returns the full HTML response body for the given status code.
pub
/// Shared error page renderer stored in app state / middleware.
pub type SharedRenderer = ;
/// Create the default shared renderer.
pub