From 2809e6512d2616562aa2ef70a4af265bdef95f35 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sun, 1 Dec 2024 11:06:58 +0100 Subject: [PATCH 1/3] Rename axum-extra's error_response feature to error-response To align the name with the other kebab-cased feature names. --- axum-extra/Cargo.toml | 2 +- axum-extra/src/response/mod.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/axum-extra/Cargo.toml b/axum-extra/Cargo.toml index 6bfe835a13..11079e4739 100644 --- a/axum-extra/Cargo.toml +++ b/axum-extra/Cargo.toml @@ -16,7 +16,7 @@ default = ["tracing", "multipart"] async-read-body = ["dep:tokio-util", "tokio-util?/io", "dep:tokio"] attachment = ["dep:tracing"] -error_response = ["dep:tracing", "tracing/std"] +error-response = ["dep:tracing", "tracing/std"] cookie = ["dep:cookie"] cookie-private = ["cookie", "cookie?/private"] cookie-signed = ["cookie", "cookie?/signed"] diff --git a/axum-extra/src/response/mod.rs b/axum-extra/src/response/mod.rs index bac7d040fe..c5cc12522e 100644 --- a/axum-extra/src/response/mod.rs +++ b/axum-extra/src/response/mod.rs @@ -9,10 +9,10 @@ mod attachment; #[cfg(feature = "multipart")] pub mod multiple; -#[cfg(feature = "error_response")] +#[cfg(feature = "error-response")] mod error_response; -#[cfg(feature = "error_response")] +#[cfg(feature = "error-response")] pub use error_response::InternalServerError; #[cfg(feature = "erased-json")] From 491123fa496daece1bd80b3f240c650e3162a3a9 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sun, 1 Dec 2024 11:08:35 +0100 Subject: [PATCH 2/3] Document the error-response feature --- axum-extra/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/axum-extra/src/lib.rs b/axum-extra/src/lib.rs index 5bdab167a9..55a5052246 100644 --- a/axum-extra/src/lib.rs +++ b/axum-extra/src/lib.rs @@ -16,6 +16,7 @@ //! `cookie-signed` | Enables the [`SignedCookieJar`](crate::extract::SignedCookieJar) extractor | No //! `cookie-key-expansion` | Enables the [`Key::derive_from`](crate::extract::cookie::Key::derive_from) method | No //! `erased-json` | Enables the [`ErasedJson`](crate::response::ErasedJson) response | No +//! `error-response` | Enables the [`InternalServerError`](crate::response::InternalServerError) response | No //! `form` | Enables the [`Form`](crate::extract::Form) extractor | No //! `json-deserializer` | Enables the [`JsonDeserializer`](crate::extract::JsonDeserializer) extractor | No //! `json-lines` | Enables the [`JsonLines`](crate::extract::JsonLines) extractor and response | No From 7296464207b10da7c50e9d0da08fbe37f9c0077a Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sun, 1 Dec 2024 11:12:48 +0100 Subject: [PATCH 3/3] Add error-response feature to changelog --- axum-extra/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/axum-extra/CHANGELOG.md b/axum-extra/CHANGELOG.md index 327e3edbb4..cfced32acd 100644 --- a/axum-extra/CHANGELOG.md +++ b/axum-extra/CHANGELOG.md @@ -10,10 +10,13 @@ and this project adheres to [Semantic Versioning]. - **fixed:** `Host` extractor includes port number when parsing authority ([#2242]) - **added:** Add `RouterExt::typed_connect` ([#2961]) - **added:** Add `json!` for easy construction of JSON responses ([#2962]) +- **added:** Add `InternalServerError` response for logging an internal error + and returning HTTP 500 in a convenient way. ([#3010]) [#2242]: https://github.com/tokio-rs/axum/pull/2242 [#2961]: https://github.com/tokio-rs/axum/pull/2961 [#2962]: https://github.com/tokio-rs/axum/pull/2962 +[#3010]: https://github.com/tokio-rs/axum/pull/3010 # 0.10.0