From 7e47f09e54b65c26a7ec474a73d62af64eeeb157 Mon Sep 17 00:00:00 2001 From: nutcas3 Date: Sat, 25 Apr 2026 03:03:27 +0300 Subject: [PATCH] feat: Replace RedisOperation with DatabaseError in rating_plans_repo error mapping - Replace RedisOperation error variant with DatabaseError in new/get/list_map/add/remove methods - Update 5 map_err calls to use DatabaseError for SQLx operation failures --- apps/charging-engine/src/charging/rating_plans_repo.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/charging-engine/src/charging/rating_plans_repo.rs b/apps/charging-engine/src/charging/rating_plans_repo.rs index b47c8e2..e7a90d3 100644 --- a/apps/charging-engine/src/charging/rating_plans_repo.rs +++ b/apps/charging-engine/src/charging/rating_plans_repo.rs @@ -49,7 +49,7 @@ impl RatingPlansRepo { ) .execute(&pool) .await - .map_err(|e| crate::errors::ChargingError::RedisOperation(e.to_string()))?; + .map_err(|e| crate::errors::ChargingError::DatabaseError(e.to_string()))?; Ok(Self { pool }) } @@ -112,7 +112,7 @@ impl RatingPlansRepo { .bind(plan_id) .fetch_optional(&self.pool) .await - .map_err(|e| crate::errors::ChargingError::RedisOperation(e.to_string()))?; + .map_err(|e| crate::errors::ChargingError::DatabaseError(e.to_string()))?; Ok(row.map(row_to_plan)) } @@ -129,7 +129,7 @@ impl RatingPlansRepo { ) .fetch_all(&self.pool) .await - .map_err(|e| crate::errors::ChargingError::RedisOperation(e.to_string()))?; + .map_err(|e| crate::errors::ChargingError::DatabaseError(e.to_string()))?; let mut out = HashMap::with_capacity(rows.len()); for row in rows { @@ -192,7 +192,7 @@ impl RatingPlansRepo { .bind(plan.sms_limit as i64) .execute(&self.pool) .await - .map_err(|e| crate::errors::ChargingError::RedisOperation(e.to_string()))?; + .map_err(|e| crate::errors::ChargingError::DatabaseError(e.to_string()))?; Ok(()) } @@ -204,7 +204,7 @@ impl RatingPlansRepo { .bind(plan_id) .execute(&self.pool) .await - .map_err(|e| crate::errors::ChargingError::RedisOperation(e.to_string()))?; + .map_err(|e| crate::errors::ChargingError::DatabaseError(e.to_string()))?; Ok(result.rows_affected() > 0) } }