Skip to content

Commit

Permalink
Improve error for unsupported organs
Browse files Browse the repository at this point in the history
  • Loading branch information
axdanbol committed Feb 9, 2024
1 parent b1bac58 commit b03d7b9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/algorithm/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,15 @@ def __load_metadata(self, organ: str, organ_metadata: Path) -> OrganMetadata:
Returns:
OrganMetadata: Organ specific metadata
Raises:
ValueError: If the organ is not supported by the algorithm
"""
with open(organ_metadata) as file:
data = json.load(file)
return data[organ]
metadata = json.load(file)
if organ not in metadata:
raise ValueError(f"Organ {organ} is not supported")
return metadata[organ]

def __post_process_result(
self, result: RunResult, organ: str, metadata: OrganMetadata
Expand Down

0 comments on commit b03d7b9

Please sign in to comment.