mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-11-01 02:57:02 +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 { |         Ok(ErrorResponse { | ||||||
|             status_code: res.status_code, |             status_code: res.status_code, | ||||||
|             code: response.status.to_string(), |             code: response.status.to_string(), | ||||||
|             message: format!("{:?}", response.errors.first().unwrap_or(&default_error)), |             message: format!( | ||||||
|             reason: Some(format!("{:?}", response.errors)), |                 "{:?}", | ||||||
|  |                 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 struct TrustpayErrorResponse { | ||||||
|     pub status: i64, |     pub status: i64, | ||||||
|     pub description: Option<String>, |     pub description: Option<String>, | ||||||
|     pub errors: Vec<Errors>, |     pub errors: Option<Vec<Errors>>, | ||||||
| } | } | ||||||
|  |  | ||||||
| #[derive(Deserialize)] | #[derive(Deserialize)] | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Arjun Karthik
					Arjun Karthik