[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.
This commit is contained in:
Fabio Manganiello 2024-01-13 13:24:47 +01:00
parent 18bba7e3bf
commit f0dcb94862
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 7 additions and 0 deletions

View File

@ -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: