Skip to content

Commit

Permalink
feat: catch panics; more info on the error page (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
m4tx authored Sep 27, 2024
1 parent 3ab0e57 commit 054ccec
Show file tree
Hide file tree
Showing 9 changed files with 583 additions and 107 deletions.
32 changes: 17 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ askama = "0.12.1"
async-stream = "0.3.5"
async-trait = "0.1.80"
axum = "0.7.5"
backtrace = "0.3.74"
bytes = "1.7.1"
cargo_toml = "0.20.4"
chrono = { version = "0.4.38", features = ["serde"] }
Expand All @@ -40,6 +41,7 @@ flareon_macros = { path = "flareon-macros" }
form_urlencoded = "1.2.1"
futures = "0.3.30"
futures-core = "0.3.30"
futures-util = "0.3.30"
glob = "0.3.1"
http = "1.1.0"
http-body = "1.0.1"
Expand Down
2 changes: 2 additions & 0 deletions flareon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ description = "Modern web framework focused on speed and ease of use."
askama.workspace = true
async-trait.workspace = true
axum.workspace = true
backtrace.workspace = true
bytes.workspace = true
chrono.workspace = true
derive_builder.workspace = true
derive_more.workspace = true
flareon_macros.workspace = true
form_urlencoded.workspace = true
futures-core.workspace = true
futures-util.workspace = true
http.workspace = true
http-body.workspace = true
http-body-util.workspace = true
Expand Down
16 changes: 16 additions & 0 deletions flareon/src/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// Debug mode flag
///
/// This enables some expensive operations that are useful for debugging, such
/// as logging additional information, and collecting some extra diagnostics
/// for generating error pages. This hurts the performance, so it should be
/// disabled for production.
///
/// This is `true` when the application is compiled in debug mode, and `false`
/// when it is compiled in release mode.
pub(crate) const DEBUG_MODE: bool = cfg!(debug_assertions);

/// Whether to display a nice, verbose error page when an error, panic, or
/// 404 "Not Found" occurs.
pub(crate) const DISPLAY_ERROR_PAGE: bool = DEBUG_MODE;

pub(crate) const REGISTER_PANIC_HOOK: bool = true;
Loading

0 comments on commit 054ccec

Please sign in to comment.