diff --git a/catalyst-gateway/bin/src/service/common/responses/mod.rs b/catalyst-gateway/bin/src/service/common/responses/mod.rs index d7f9eececaf..7f86a27c52c 100644 --- a/catalyst-gateway/bin/src/service/common/responses/mod.rs +++ b/catalyst-gateway/bin/src/service/common/responses/mod.rs @@ -134,10 +134,12 @@ impl WithErrorResponses { 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. diff --git a/catalyst-gateway/bin/src/service/common/types/headers/retry_after.rs b/catalyst-gateway/bin/src/service/common/types/headers/retry_after.rs index cb465e7633d..d2ccc8fcc59 100644 --- a/catalyst-gateway/bin/src/service/common/types/headers/retry_after.rs +++ b/catalyst-gateway/bin/src/service/common/types/headers/retry_after.rs @@ -36,16 +36,6 @@ pub(crate) enum RetryAfterOption { Some(RetryAfterHeader), } -impl From for Option { - 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 {