From 1f099689a3b900c9cac88142815b62ba2f88479c Mon Sep 17 00:00:00 2001 From: w2 Date: Tue, 26 Sep 2023 09:40:03 +0100 Subject: [PATCH] add: basic upload error reporting --- backend/src/main.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/src/main.py b/backend/src/main.py index 56a05ed..4412323 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -201,7 +201,15 @@ def create_items( for row in sheet["data"] ] # dump all the data into database - accepted, processed = crud.insert_items(db=db, items=spreadsheet_item_list) + try: + accepted, processed = crud.insert_items(db=db, items=spreadsheet_item_list) + except Exception as e: + raise HTTPException( + status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, + detail="{}".format( + e + ), + ) # transform spreadsheet coordinates data into spacial crud.add_spacial_data(db=db)