From 95fff6da92194f186d3343fd3e926df8ef9c4850 Mon Sep 17 00:00:00 2001 From: Corey Lowman Date: Mon, 1 Jul 2024 10:00:40 -0400 Subject: [PATCH] Handling self.error_string() failing in Debug for DriverError (#267) * Handling self.error_string() failing in Debug for DriverError * Fixing clippy --- src/driver/result.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/driver/result.rs b/src/driver/result.rs index c85428c..4865eba 100644 --- a/src/driver/result.rs +++ b/src/driver/result.rs @@ -60,11 +60,18 @@ impl DriverError { impl std::fmt::Debug for DriverError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let err_str = self.error_string().unwrap(); - f.debug_tuple("DriverError") - .field(&self.0) - .field(&err_str) - .finish() + match self.error_string() { + Ok(err_str) => f + .debug_tuple("DriverError") + .field(&self.0) + .field(&err_str) + .finish(), + Err(_) => f + .debug_tuple("DriverError") + .field(&self.0) + .field(&"") + .finish(), + } } }