From c3368d9f8b0381b982d8defd7fa004c3d3b87da4 Mon Sep 17 00:00:00 2001 From: ItsMeShashank Date: Fri, 6 Jan 2023 18:04:08 +0530 Subject: [PATCH] fix(router): handle panic-prone code with proper errors (#297) --- crates/router/src/core/payments/helpers.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index eab26a8553..85e817434b 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -659,8 +659,8 @@ pub async fn get_connector_default( .change_context(errors::ConnectorError::RoutingRulesParsingError) .change_context(errors::ApiErrorResponse::InternalServerError)?; let custom_routing_rules: api::CustomRoutingRules = vec_val - .first() - .cloned() + .into_iter() + .next() .parse_value("CustomRoutingRules") .change_context(errors::ConnectorError::RoutingRulesParsingError) .change_context(errors::ApiErrorResponse::InternalServerError)?;