From 844d65675cc079671b8f0f3ab63c9aae02c9a1ee Mon Sep 17 00:00:00 2001 From: Michael Cuffaro Date: Mon, 5 Feb 2024 11:01:26 -0500 Subject: [PATCH] better error message when not able to determine the sql type --- src/lib.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e498c14a..1a14ad7b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3000,15 +3000,13 @@ pub fn get_table_constraints( } for row in colvals { - let sql_type = get_sql_type( - datatypes_config, - &row.get("datatype") - .and_then(|d| d.as_str()) - .and_then(|s| Some(s.to_string())) - .unwrap(), - pool, - ) - .unwrap(); + let datatype = row + .get("datatype") + .and_then(|d| d.as_str()) + .and_then(|s| Some(s.to_string())) + .unwrap(); + let sql_type = get_sql_type(datatypes_config, &datatype, pool) + .expect(&format!("Unable to determine SQL type for {}", datatype)); let column_name = row.get("column").and_then(|s| s.as_str()).unwrap(); let structure = row.get("structure").and_then(|s| s.as_str()); if let Some(structure) = structure {