Skip to content

Commit

Permalink
tenant_status: don't InternalServerError if tenant not found (#4337)
Browse files Browse the repository at this point in the history
Note this also changes the status code to the (correct) 404. Not sure if
that's relevant to Console.

Context:
https://neondb.slack.com/archives/C04PSBP2SAF/p1684746238831449?thread_ts=1684742106.169859&cid=C04PSBP2SAF

Atop #4300 because it cleans up the mgr::get_tenant() error type and I want eyes on that PR.
  • Loading branch information
problame authored May 25, 2023
1 parent 37ecebe commit 83ba02b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pageserver/src/http/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,16 +543,15 @@ async fn tenant_status(request: Request<Body>) -> Result<Response<Body>, ApiErro
}

let state = tenant.current_state();
Ok(TenantInfo {
Result::<_, ApiError>::Ok(TenantInfo {
id: tenant_id,
state: state.clone(),
current_physical_size: Some(current_physical_size),
attachment_status: state.attachment_status(),
})
}
.instrument(info_span!("tenant_status_handler", tenant = %tenant_id))
.await
.map_err(ApiError::InternalServerError)?;
.await?;

json_response(StatusCode::OK, tenant_info)
}
Expand Down

0 comments on commit 83ba02b

Please sign in to comment.