Skip to content

Commit

Permalink
fixup: raise from
Browse files Browse the repository at this point in the history
  • Loading branch information
sfoster1 committed Jan 7, 2025
1 parent 0d95008 commit a706db5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/src/opentrons/protocols/labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,21 @@ def verify_definition( # noqa: C901
try:
to_return = json.loads(contents)
except json.JSONDecodeError as e:
raise NotALabwareError("invalid-json", [e])
raise NotALabwareError("invalid-json", [e]) from e
try:
schema_version = to_return["schemaVersion"]
except KeyError as e:
raise NotALabwareError("no-schema-id", [e])
raise NotALabwareError("no-schema-id", [e]) from e

try:
schema = schemata_by_version[schema_version]
except KeyError as e:
raise NotALabwareError("bad-schema-id", [e])
raise NotALabwareError("bad-schema-id", [e]) from e

try:
jsonschema.validate(to_return, schema)
except jsonschema.ValidationError as e:
raise NotALabwareError("schema-mismatch", [e])
raise NotALabwareError("schema-mismatch", [e]) from e

# we can type ignore this because if it passes the jsonschema it has
# the correct structure
Expand Down

0 comments on commit a706db5

Please sign in to comment.