Skip to content
Snippets Groups Projects
Unverified Commit d1d22170 authored by Jonas Platte's avatar Jonas Platte
Browse files

Clean up error handling for server_server::get_server_keys_route

parent 1f7b3fa4
No related branches found
No related tags found
No related merge requests found
......@@ -516,10 +516,9 @@ pub async fn get_server_version_route(
/// forever.
// Response type for this endpoint is Json because we need to calculate a signature for the response
#[tracing::instrument(skip(db))]
pub async fn get_server_keys_route(db: DatabaseGuard) -> impl IntoResponse {
pub async fn get_server_keys_route(db: DatabaseGuard) -> Result<impl IntoResponse> {
if !db.globals.allow_federation() {
// TODO: Use proper types
return Json("Federation is disabled.").into_response();
return Err(Error::bad_config("Federation is disabled."));
}
let mut verify_keys: BTreeMap<Box<ServerSigningKeyId>, VerifyKey> = BTreeMap::new();
......@@ -557,7 +556,7 @@ pub async fn get_server_keys_route(db: DatabaseGuard) -> impl IntoResponse {
)
.unwrap();
Json(response).into_response()
Ok(Json(response))
}
/// # `GET /_matrix/key/v2/server/{keyId}`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment