From 39f762df8dcb994cd499e0586afa9b62fe5d19e8 Mon Sep 17 00:00:00 2001 From: aldo Date: Sun, 1 Dec 2024 14:14:23 -0600 Subject: [PATCH] New error catching --- BackEndFlask/Functions/exportCsv.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/BackEndFlask/Functions/exportCsv.py b/BackEndFlask/Functions/exportCsv.py index 396201b8e..1e0476524 100644 --- a/BackEndFlask/Functions/exportCsv.py +++ b/BackEndFlask/Functions/exportCsv.py @@ -289,7 +289,10 @@ def create_csv_strings(at_id:int, type_csv:int=1) -> str: Exceptions: None except the chance the database or IO calls raise one. """ - type_csv = CSV_Type(type_csv) + try: + type_csv = CSV_Type(type_csv) + except: + raise ValueError("No type of csv is associated for the value passed.") match type_csv: case CSV_Type.RATING_CSV: return Ratings_Csv(at_id).return_csv_str() @@ -298,4 +301,4 @@ def create_csv_strings(at_id:int, type_csv:int=1) -> str: case CSV_Type.COMMENTS_CSV: return Comments_Csv(at_id).return_csv_str() case _: - return "No current class meets the deisred csv format. Error in create_csv_strings()." \ No newline at end of file + return "Error in create_csv_strings()." \ No newline at end of file