Catch all errors when doing mqtt message unicode-decode. (#4143)

* catch all errors when doing mqtt message unicode-decode.

* added AttributeError and UnicodeDecodeError to exception when decoding an mqtt message payload
pull/4132/head
Michael 2016-10-30 15:17:41 -07:00 committed by Fabian Affolter
parent 8e695d1eb0
commit 705814cb08
1 changed files with 1 additions and 1 deletions

View File

@ -399,7 +399,7 @@ class MQTT(object):
"""Message received callback."""
try:
payload = msg.payload.decode('utf-8')
except AttributeError:
except (AttributeError, UnicodeDecodeError):
_LOGGER.error("Illegal utf-8 unicode payload from "
"MQTT topic: %s, Payload: %s", msg.topic,
msg.payload)