forked from platypush/platypush
[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:
parent
18bba7e3bf
commit
f0dcb94862
1 changed files with 7 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue