Skip to content

Commit

Permalink
fix: return correct message when validation error occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
katiestahl committed Sep 24, 2024
1 parent 38e99b4 commit 951c7d3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/fusor/fusor.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,12 @@ def categorical_fusion(
regulatoryElement=regulatory_element,
)
except ValidationError as e:
raise FUSORParametersException(str(e)) from e
error_message = (
str(e.errors()[0]["msg"])
if e.errors() and "msg" in e.errors()[0]
else str(e)
)
raise FUSORParametersException(error_message) from e
return fusion

@staticmethod
Expand Down Expand Up @@ -209,7 +214,12 @@ def assayed_fusion(
readingFramePreserved=reading_frame_preserved,
)
except ValidationError as e:
raise FUSORParametersException(str(e)) from e
error_message = (
str(e.errors()[0]["msg"])
if e.errors() and "msg" in e.errors()[0]
else str(e)
)
raise FUSORParametersException(error_message) from e
return fusion

async def transcript_segment_element(
Expand Down

0 comments on commit 951c7d3

Please sign in to comment.