Browse Source

Failure is not an option. Raise an exception.

pyserial_fix
f34rdotcom 6 years ago
parent
commit
cf9ed59cb7
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      alarmdecoder/decoder.py

+ 4
- 1
alarmdecoder/decoder.py View File

@@ -415,7 +415,10 @@ class AlarmDecoder(object):
:returns: :py:class:`~alarmdecoder.messages.Message` :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: if data is not None:
data = data.lstrip('\0') data = data.lstrip('\0')


Loading…
Cancel
Save