Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Leshiy committed Jan 16, 2025
1 parent 336ebf3 commit 52c23c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
10 changes: 6 additions & 4 deletions catalyst-gateway/bin/src/service/common/responses/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,12 @@ impl<T> WithErrorResponses<T> {
pub(crate) fn service_unavailable(err: &anyhow::Error, retry: RetryAfterOption) -> Self {
let error = ServiceUnavailable::new(None);
error!(id=%error.id(), error=?err, retry_after=?retry);
WithErrorResponses::Error(ErrorResponses::ServiceUnavailable(
Json(error),
retry.into(),
))
let retry = match retry {
RetryAfterOption::Default => Some(RetryAfterHeader::default()),
RetryAfterOption::None => None,
RetryAfterOption::Some(value) => Some(value),
};
WithErrorResponses::Error(ErrorResponses::ServiceUnavailable(Json(error), retry))
}

/// Handle a 500 internal error response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ pub(crate) enum RetryAfterOption {
Some(RetryAfterHeader),
}

impl From<RetryAfterOption> for Option<RetryAfterHeader> {
fn from(value: RetryAfterOption) -> Self {
match value {
RetryAfterOption::Default => Some(RetryAfterHeader::default()),
RetryAfterOption::None => None,
RetryAfterOption::Some(value) => Some(value),
}
}
}

impl Display for RetryAfterHeader {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Expand Down

0 comments on commit 52c23c5

Please sign in to comment.