diff --git a/nvchecker/core.py b/nvchecker/core.py index 7130bd7..5373601 100644 --- a/nvchecker/core.py +++ b/nvchecker/core.py @@ -259,7 +259,7 @@ class Dispatcher: func = mod.get_version ctx.run(worker.initialize, func) - ret.append(ctx.run(worker.run)) + ret.append(ctx.run(worker._run_maynot_raise)) return ret diff --git a/nvchecker/util.py b/nvchecker/util.py index 084da0a..85b65e7 100644 --- a/nvchecker/util.py +++ b/nvchecker/util.py @@ -146,6 +146,13 @@ class BaseWorker: '''Run the `tasks`. Subclasses should implement this method.''' raise NotImplementedError + async def _run_maynot_raise(self) -> None: + try: + await self.run() + except Exception: + # don't let an exception tear down the whole process + logger.exception('exception raised by Worker.run') + class AsyncCache: '''A cache for use with async functions.''' cache: Dict[Hashable, Any]