forked from platypush/platypush
Better exception management in AsyncRunnablePlugin
.
Exceptions that cause the termination of the plugin's loop should always be logged as such, unless the plugin is supposed to stop and various exceptions may occur upon teardown.
This commit is contained in:
parent
a6c36fa1c1
commit
9112239ac3
1 changed files with 3 additions and 1 deletions
|
@ -212,7 +212,9 @@ class AsyncRunnablePlugin(RunnablePlugin, ABC):
|
||||||
try:
|
try:
|
||||||
self._loop.run_until_complete(self._task)
|
self._loop.run_until_complete(self._task)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.info('The loop has terminated with an error: %s', e)
|
if not self.should_stop():
|
||||||
|
self.logger.warning('The loop has terminated with an error')
|
||||||
|
self.logger.exception(e)
|
||||||
|
|
||||||
self._task.cancel()
|
self._task.cancel()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue