From cf34641957e03471f2cf232f6345915cfbc7b40e Mon Sep 17 00:00:00 2001
From: Matthew Hagemann <matt.hagemann@canonical.com>
Date: Wed, 20 Nov 2024 11:25:45 +0200
Subject: [PATCH] feat: log error before losing detail in chart.rs

---
 crates/ratings_new/src/grpc/charts.rs | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/crates/ratings_new/src/grpc/charts.rs b/crates/ratings_new/src/grpc/charts.rs
index 733c8c32..e2f30872 100644
--- a/crates/ratings_new/src/grpc/charts.rs
+++ b/crates/ratings_new/src/grpc/charts.rs
@@ -91,12 +91,15 @@ impl Chart for ChartService {
                 };
                 Ok(Response::new(payload))
             }
-            Err(error) => match error {
-                ChartError::NotFound => {
-                    Err(Status::not_found("Cannot find data for given timeframe."))
+            Err(e) => {
+                error!("Error in get_votes_summary: {:?}", e);
+                match e {
+                    ChartError::NotFound => {
+                        Err(Status::not_found("Cannot find data for given timeframe."))
+                    }
+                    _ => Err(Status::unknown("Internal server error")),
                 }
-                _ => Err(Status::unknown("Internal server error")),
-            },
+            }
         }
     }
 }