NOT_FOUND if server not found

This commit is contained in:
mbecker20
2025-10-03 03:17:37 -07:00
parent 4bb486ad0a
commit 5d4326f46f
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ pub async fn handler(
let server = crate::resource::get::<Server>(&_server)
.await
.status_code(StatusCode::BAD_REQUEST)?;
.status_code(StatusCode::NOT_FOUND)?;
if !server.config.enabled {
return Err(anyhow!("Server is Disabled."))
+3 -2
View File
@@ -94,8 +94,9 @@ async fn connect_websocket(
.await
.map_err(|e| match e {
tungstenite::Error::Http(response) => match response.status() {
StatusCode::BAD_REQUEST => anyhow!("400 Bad Request: Server '{connect_as}' does not exist, is disabled, or is configured to make Core → Periphery connection"),
StatusCode::UNAUTHORIZED => anyhow!("401 Unauthorized: Only one Server connected as '{connect_as}' is allowed."),
StatusCode::NOT_FOUND => anyhow!("404 Not Found: Server '{connect_as}' does not exist."),
StatusCode::BAD_REQUEST => anyhow!("400 Bad Request: Server '{connect_as}' is disabled or configured to make Core → Periphery connection"),
StatusCode::UNAUTHORIZED => anyhow!("401 Unauthorized: Only one Server connected as '{connect_as}' is allowed. Or the Core reverse proxy needs to forward host and websocket headers."),
_ => anyhow::Error::from(tungstenite::Error::Http(response)),
},
e => anyhow::Error::from(e),