Skip to content

Commit

Permalink
also return gateway timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Aug 30, 2024
1 parent 9dbe0b1 commit 0b61ff4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion nexus/src/app/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,18 @@ impl From<SledAgentInstanceError> for dropshot::HttpError {
// a 4xx error. So, instead, we construct an internal error and
// then munge its status code.
let mut error = HttpError::for_internal_error(e.to_string());
error.status_code = http::StatusCode::BAD_GATEWAY;
error.status_code = if e.is_timeout() {
// This isn't actually in the RFD, but I thought it might be
// nice to return 503 Gateway Timeout when the
// communication error is a timeout...
http::StatusCode::GATEWAY_TIMEOUT
} else {
http::StatusCode::BAD_GATEWAY
};
error
}
// Invalid request errors from the sled-agent should return 500
// Internal Server Errors.
progenitor_client::Error::InvalidRequest(s) => {
HttpError::for_internal_error(s)
}
Expand Down

0 comments on commit 0b61ff4

Please sign in to comment.