Skip to content

Commit

Permalink
Catching UnicodeDecodeError in unpack function
Browse files Browse the repository at this point in the history
  • Loading branch information
jainmohit2001 committed Oct 15, 2024
1 parent c5d52bf commit 293d86b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ocpp/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def unpack(msg):
"""
try:
msg = json.loads(msg)
except json.JSONDecodeError:
except (json.JSONDecodeError, UnicodeDecodeError):
raise FormatViolationError(
details={"cause": "Message is not valid JSON", "ocpp_message": msg}
)
Expand Down

0 comments on commit 293d86b

Please sign in to comment.