Skip to content

Commit

Permalink
New error catching
Browse files Browse the repository at this point in the history
  • Loading branch information
aldo committed Dec 1, 2024
1 parent 16c2f97 commit 39f762d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions BackEndFlask/Functions/exportCsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()."
return "Error in create_csv_strings()."

0 comments on commit 39f762d

Please sign in to comment.