mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +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
	 Arjun Karthik
					Arjun Karthik