Skip to content

Commit a9cda3f

Browse files
authored
Merge pull request #81 from datakind/Validation-Errors
adjusted validation files
2 parents 3e3f4c0 + ab46919 commit a9cda3f

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

src/webapp/routers/data.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -900,16 +900,21 @@ def validation_helper(
900900
detail="File type is not valid and/or not accepted by this institution: "
901901
+ str(e),
902902
) from e
903-
new_file_record = FileTable(
904-
name=file_name,
905-
inst_id=str_to_uuid(inst_id),
906-
uploader=str_to_uuid(current_user.user_id),
907-
source=source_str,
908-
sst_generated=False,
909-
schemas=list(inferred_schemas),
910-
valid=True,
911-
)
912-
local_session.get().add(new_file_record)
903+
904+
try:
905+
new_file_record = FileTable(
906+
name=file_name,
907+
inst_id=str_to_uuid(inst_id),
908+
uploader=str_to_uuid(current_user.user_id),
909+
source=source_str,
910+
sst_generated=False,
911+
schemas=list(inferred_schemas),
912+
valid=True,
913+
)
914+
local_session.get().add(new_file_record)
915+
except Exception as e:
916+
logging.error(f"Error message: {str(e)}")
917+
913918
return {
914919
"name": file_name,
915920
"inst_id": inst_id,

0 commit comments

Comments
 (0)