mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
fix(connector): [Trustpay] handle errors fields as optional in TrustpayErrorResponse object (#1514)
This commit is contained in:
@ -112,8 +112,16 @@ impl ConnectorCommon for Trustpay {
|
||||
Ok(ErrorResponse {
|
||||
status_code: res.status_code,
|
||||
code: response.status.to_string(),
|
||||
message: format!("{:?}", response.errors.first().unwrap_or(&default_error)),
|
||||
reason: Some(format!("{:?}", response.errors)),
|
||||
message: format!(
|
||||
"{:?}",
|
||||
response
|
||||
.errors
|
||||
.as_ref()
|
||||
.unwrap_or(&vec![])
|
||||
.first()
|
||||
.unwrap_or(&default_error)
|
||||
),
|
||||
reason: response.errors.map(|errors| format!("{:?}", errors)),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -1290,7 +1290,7 @@ pub struct Errors {
|
||||
pub struct TrustpayErrorResponse {
|
||||
pub status: i64,
|
||||
pub description: Option<String>,
|
||||
pub errors: Vec<Errors>,
|
||||
pub errors: Option<Vec<Errors>>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user