Skip to content

Commit

Permalink
Failure is not an option. Raise an exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
f34rdotcom committed Apr 14, 2018
1 parent 25bb5b2 commit cf9ed59
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion alarmdecoder/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,10 @@ def _handle_message(self, data):
:returns: :py:class:`~alarmdecoder.messages.Message`
"""

data = data.decode('utf-8')
try:
data = data.decode('utf-8')
except:
raise InvalidMessageError('Decode failed for message: {0}'.format(data))

if data is not None:
data = data.lstrip('\0')
Expand Down

0 comments on commit cf9ed59

Please sign in to comment.