We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
IntoResponse
RouteBlocked
1 parent bbcc099 commit 8260ce5Copy full SHA for 8260ce5
src/util/errors/json.rs
@@ -1,3 +1,5 @@
1
+use axum::response::{IntoResponse, Response};
2
+use axum::Json;
3
use std::fmt;
4
5
use super::{AppError, InternalAppErrorStatic};
@@ -286,3 +288,10 @@ impl fmt::Display for RouteBlocked {
286
288
f.write_str("This route is temporarily blocked. See https://status.crates.io.")
287
289
}
290
291
+
292
+impl IntoResponse for RouteBlocked {
293
+ fn into_response(self) -> Response {
294
+ let body = Json(json!({ "errors": [{ "detail": self.to_string() }] }));
295
+ (StatusCode::SERVICE_UNAVAILABLE, body).into_response()
296
+ }
297
+}
0 commit comments