refactor: Fix errors in api/server/well_known.rs

This commit is contained in:
Ginger
2026-04-28 09:16:56 -04:00
parent e7a1c71a25
commit 0f64e6b49c
+6 -6
View File
@@ -1,6 +1,6 @@
use axum::extract::State; use axum::extract::State;
use conduwuit::{Error, Result}; use conduwuit::{Err, Result};
use ruma::api::{client::error::ErrorKind, federation::discovery::discover_homeserver}; use ruma::api::federation::discovery::discover_homeserver;
use crate::Ruma; use crate::Ruma;
@@ -11,10 +11,10 @@ pub(crate) async fn well_known_server(
State(services): State<crate::State>, State(services): State<crate::State>,
_body: Ruma<discover_homeserver::Request>, _body: Ruma<discover_homeserver::Request>,
) -> Result<discover_homeserver::Response> { ) -> Result<discover_homeserver::Response> {
Ok(discover_homeserver::Response { Ok(discover_homeserver::Response::new(
server: match services.server.config.well_known.server.as_ref() { match services.server.config.well_known.server.as_ref() {
| Some(server_name) => server_name.to_owned(), | Some(server_name) => server_name.to_owned(),
| None => return Err(Error::BadRequest(ErrorKind::NotFound, "Not found.")), | None => return Err!(Request(NotFound("No well-known server URL is configured."))),
}, },
}) ))
} }