From 01006046e0edd5fad9e56fc037ae8d00b8db1f30 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 27 Dec 2018 22:45:31 +0100 Subject: [PATCH] Don't try to push a Pushbullet note body to the bus if it's not a valid JSON --- platypush/backend/pushbullet/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/platypush/backend/pushbullet/__init__.py b/platypush/backend/pushbullet/__init__.py index 864d79dd2..2c79db6c9 100644 --- a/platypush/backend/pushbullet/__init__.py +++ b/platypush/backend/pushbullet/__init__.py @@ -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