diff options
| author | tv <tv@krebsco.de> | 2026-10-26 05:00:06 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-26 05:00:06 +0100 |
| commit | 9a6ddd492409801e68ee0c3656d399bf897824ba (patch) | |
| tree | 7973367d6dbededbfaeacb0d135c72accf79db69 /src/remake/api.rs | |
| parent | 4757195353fc37eb15c2fa2e981cde4421ea588a (diff) | |
unify API error responses
Diffstat (limited to 'src/remake/api.rs')
| -rw-r--r-- | src/remake/api.rs | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/remake/api.rs b/src/remake/api.rs index 24fb7e8..515468d 100644 --- a/src/remake/api.rs +++ b/src/remake/api.rs @@ -72,6 +72,7 @@ use super::records::{ Retention, Vote, }; use super::{Host, kind, vote}; +use crate::api::error_response; use crate::document::store::StoreError; use crate::force::Force; @@ -281,18 +282,6 @@ enum StartError { Store(#[from] StoreError), } -pub(super) fn error_response( - status: StatusCode, - message: impl Into<String>, - details: Option<JsonValue>, -) -> Response { - let mut body = json!({ "error": message.into() }); - if let (Some(JsonValue::Object(extra)), Some(object)) = (details, body.as_object_mut()) { - object.extend(extra); - } - (status, Json(body)).into_response() -} - fn grace<H: Host>(host: &H) -> u64 { host.dormant_after().as_millis() as u64 } |
