Skip to content

Commit

Permalink
switch to using try/except
Browse files Browse the repository at this point in the history
  • Loading branch information
drc38 authored Dec 9, 2024
1 parent db1a94f commit 12b793c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ocpp/charge_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,20 @@ def _raise_key_error(action, version):
from ocpp.v201.enums import Action as v201_Action

if version == "1.6":
if action in list(v16_Action):
try v16_Action(action):
raise NotImplementedError(
details={"cause": f"No handler for {action} registered."}
)
else:
except ValueError:
raise NotSupportedError(
details={"cause": f"{action} not supported by OCPP{version}."}
)
elif version in ["2.0", "2.0.1"]:
if action in list(v201_Action):
try v201_Action(action):
raise NotImplementedError(
details={"cause": f"No handler for {action} registered."}
)
else:
except ValueError:
raise NotSupportedError(
details={"cause": f"{action} not supported by OCPP{version}."}
)
Expand Down

0 comments on commit 12b793c

Please sign in to comment.