Verified Commit a6b55250 authored by Fabio Manganiello's avatar Fabio Manganiello
Browse files

FIX: Use a separate error handler for the Pushbullet backend that doesn't...

FIX: Use a separate error handler for the Pushbullet backend that doesn't raise another exception (prevents maximum recursion errors in the logs caused by the interpreter entering an infinite loop of error handlers)
parent 833e1c49
Pipeline #139 passed with stages
in 1 minute
......@@ -135,6 +135,20 @@ class PushbulletBackend(Backend):
return callback
def on_error(self, *_):
def callback(*args):
self.logger.error(f'Pushbullet error: {args}')
try:
if self.listener:
self.listener.close()
except Exception as e:
self.logger.error('Error on Pushbullet connection close upon error')
self.logger.exception(e)
finally:
self.listener = None
return callback
def on_open(self):
def callback(*_):
self.logger.info('Pushbullet service connected')
......@@ -149,7 +163,7 @@ class PushbulletBackend(Backend):
on_push=self.on_push(),
on_open=self.on_open(),
on_close=self.on_close(),
on_error=self.on_close(),
on_error=self.on_error(),
http_proxy_host=self.proxy_host,
http_proxy_port=self.proxy_port)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment