Skip to content

Commit

Permalink
unwrap error resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
KiranKBR committed May 10, 2024
1 parent 1b31b63 commit d9c8711
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions crates/router/src/connector/payone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,24 @@ impl ConnectorCommon for Payone {
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);

let error = response.errors.first().unwrap();
Ok(ErrorResponse {
status_code: error.http_status_code,
code: error.code.clone(),
message: error.message.clone(),
reason: None,
attempt_status: None,
connector_transaction_id: None,
})
match response.errors.first() {
Some(error) => Ok(ErrorResponse {
status_code: error.http_status_code,
code: error.code.clone(),
message: error.message.clone(),
reason: None,
attempt_status: None,
connector_transaction_id: None,
}),
None => Ok(ErrorResponse {
status_code: res.status_code,
code: consts::NO_ERROR_CODE.to_string(),
message: consts::NO_ERROR_MESSAGE.to_string(),
reason: None,
attempt_status: None,
connector_transaction_id: None,
}),
}
}
}
impl ConnectorValidation for Payone {}
Expand Down

0 comments on commit d9c8711

Please sign in to comment.