Don't try to push a Pushbullet note body to the bus if it's not a valid JSON

This commit is contained in:
Fabio Manganiello 2018-12-27 22:45:31 +01:00
parent 54c3381ae3
commit 01006046e0
1 changed files with 7 additions and 3 deletions

View File

@ -89,10 +89,14 @@ class PushbulletBackend(Backend):
self.logger.debug('Received push: {}'.format(push))
body = push['body']
try: body = json.loads(body)
except ValueError as e: return # Some other non-JSON push
try:
body = json.loads(body)
self.on_message(body)
except Exception as e:
self.logger.debug(('Unexpected message received on the ' +
'Pushbullet backend: {}. Message: {}')
.format(str(e), body))
self.on_message(body)
except Exception as e:
self.logger.exception(e)
return