From 76ec7ff379c540dd352c8facf9280ea3e8930132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 3 Apr 2018 23:31:54 +0200 Subject: [PATCH] chg: Catch exceptions in the main loop --- bgpranking/abstractmanager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bgpranking/abstractmanager.py b/bgpranking/abstractmanager.py index d4fc730..f2ae4e6 100644 --- a/bgpranking/abstractmanager.py +++ b/bgpranking/abstractmanager.py @@ -23,7 +23,10 @@ class AbstractManager(ABC): while True: if shutdown_requested(): break - self._to_run_forever() + try: + self._to_run_forever() + except Exception: + self.logger.exception('Something went terribly wrong in {}.'.format(self.__class__.__name__)) if not long_sleep(sleep_in_sec): break self.logger.info('Shutting down {}'.format(self.__class__.__name__))