feat(router): send connector timeouts and connection closures as 2xx response instead of giving 5xx response (#2047)

This commit is contained in:
Sai Harsha Vardhan
2023-08-31 17:25:47 +05:30
committed by GitHub
parent c9fe389b2c
commit 31088b6062
6 changed files with 54 additions and 5 deletions

View File

@ -273,6 +273,9 @@ pub enum ApiClientError {
#[error("Server responded with Request Timeout")]
RequestTimeoutReceived,
#[error("connection closed before a message could complete")]
ConnectionClosed,
#[error("Server responded with Internal Server Error")]
InternalServerErrorReceived,
#[error("Server responded with Bad Gateway")]
@ -566,6 +569,9 @@ impl ApiClientError {
pub fn is_upstream_timeout(&self) -> bool {
self == &Self::RequestTimeoutReceived
}
pub fn is_connection_closed(&self) -> bool {
self == &Self::ConnectionClosed
}
}
impl ConnectorError {