mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
refactor(access_token): handle timeout errors gracefully (#1882)
This commit is contained in:
@ -186,7 +186,7 @@ pub fn http_not_implemented() -> actix_web::HttpResponse<BoxBody> {
|
||||
.error_response()
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[derive(Debug, thiserror::Error, PartialEq)]
|
||||
pub enum ApiClientError {
|
||||
#[error("Header map construction failed")]
|
||||
HeaderMapConstructionFailed,
|
||||
@ -315,6 +315,8 @@ pub enum ConnectorError {
|
||||
MissingPaymentMethodType,
|
||||
#[error("Balance in the payment method is low")]
|
||||
InSufficientBalanceInPaymentMethod,
|
||||
#[error("Server responded with Request Timeout")]
|
||||
RequestTimeoutReceived,
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
@ -490,6 +492,18 @@ pub enum WebhooksFlowError {
|
||||
MissingRequiredField { field_name: &'static str },
|
||||
}
|
||||
|
||||
impl ApiClientError {
|
||||
pub fn is_upstream_timeout(&self) -> bool {
|
||||
self == &Self::RequestTimeoutReceived
|
||||
}
|
||||
}
|
||||
|
||||
impl ConnectorError {
|
||||
pub fn is_connector_timeout(&self) -> bool {
|
||||
self == &Self::RequestTimeoutReceived
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "detailed_errors")]
|
||||
pub mod error_stack_parsing {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user