From f0dcb948626d08821a8d3e790963cc3947387bd1 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 13 Jan 2024 13:24:47 +0100 Subject: [PATCH] [pushbullet] Fixed `on_error` callback on the listener. The `Listener` class from the `pushbullet.py` library is a mess, and it has two internal functions to handle errors. --- platypush/plugins/pushbullet/listener.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platypush/plugins/pushbullet/listener.py b/platypush/plugins/pushbullet/listener.py index 796d0d6c6f..609d1d5ac3 100644 --- a/platypush/plugins/pushbullet/listener.py +++ b/platypush/plugins/pushbullet/listener.py @@ -17,6 +17,7 @@ class Listener(_Listener): on_close: Optional[Callable[[], None]] = None, **kwargs, ): + kwargs['on_error'] = self._err_callback() super().__init__(*args, **kwargs) self._on_open_hndl = on_open self._on_close_hndl = on_close @@ -42,5 +43,11 @@ class Listener(_Listener): return callback + def _err_callback(self): + def callback(e): + self.logger.error('Pushbullet listener error: %s: %s', type(e).__name__, e) + + return callback + # vim:sw=4:ts=4:et: