From c02ca646d28a6ae288782215b9174c0546cb7541 Mon Sep 17 00:00:00 2001 From: Michael Cuffaro Date: Fri, 6 Sep 2024 16:16:56 -0400 Subject: [PATCH] replace unwrap() --- src/valve.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/valve.rs b/src/valve.rs index 248b45a..4e67490 100644 --- a/src/valve.rs +++ b/src/valve.rs @@ -2219,7 +2219,9 @@ impl Valve { let mut record: Vec = vec![]; for (i, column) in columns.iter().enumerate() { let cell = row.try_get::<&str, &str>(column).ok().unwrap_or_default(); - let colformat = formats.get(i).unwrap(); + let colformat = formats.get(i).ok_or(ValveError::DataError(format!( + "Error retrieving ith format for i == {i}" + )))?; if *colformat != "" { let formatted_cell = format_cell(&colformat, &format_regex, &cell); record.push(formatted_cell.to_string());