Skip to content

Commit e05ab13

Browse files
naglepuffCopilot
andauthored
Check for empty omics_processings list
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 12c4786 commit e05ab13

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nmdc_server/crud.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,11 @@ def construct_zip_file_path(data_object: models.DataObject) -> str:
439439
# - We probably want to reference the workflow activity but that
440440
# involves a complicated query... need a way to join that information
441441
# in the original query (possibly in the sqlalchemy relationship)
442+
if not data_object.omics_processings:
443+
raise HTTPException(
444+
status_code=status.HTTP_400_BAD_REQUEST,
445+
detail="Data object has no associated omics processings."
446+
)
442447
omics_processing = data_object.omics_processings[0]
443448
biosamples = cast(Optional[list[models.Biosample]], omics_processing.biosample_inputs)
444449

0 commit comments

Comments
 (0)