fix: Replace unwrap with proper error handling in set_domains handler (#4643)

Closes #4635     
In `crates/client-api/src/routes/database.rs` line 1111,
`lookup_database_identity` returns a `Result` but the error was handled
with `.unwrap()`, which panics instead of returning an HTTP 500.
Replaced it with `.map_err(log_and_500)?` to match the rest of the file.

---------

Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
This commit is contained in:
Shiven Garia
2026-03-19 04:32:38 +05:30
committed by GitHub
parent 6b1db9aa9b
commit 28cb32c284
+6 -1
View File
@@ -1107,7 +1107,12 @@ pub async fn set_names<S: ControlStateDelegate + Authorization>(
})?;
for name in &validated_names {
if ctx.lookup_database_identity(name.as_str()).await.unwrap().is_some() {
if ctx
.lookup_database_identity(name.as_str())
.await
.map_err(log_and_500)?
.is_some()
{
return Ok((
StatusCode::BAD_REQUEST,
axum::Json(name::SetDomainsResult::OtherError(format!(