From bac38ece5d008ccff263716a0e74dded3c70f8e5 Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Sat, 2 May 2020 13:29:20 +0200 Subject: [PATCH] [core/module] only log an error when a module cannot be loaded improve logging of import errors see #606 --- core/module.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/module.py b/core/module.py index 4b10c3a..2ccce29 100644 --- a/core/module.py +++ b/core/module.py @@ -1,3 +1,4 @@ +import os import importlib import logging @@ -19,11 +20,10 @@ def load(module_name, config=core.config.Config([]), theme=None): for namespace in [ 'core', 'contrib' ]: try: mod = importlib.import_module('modules.{}.{}'.format(namespace, module_short)) + log.debug('importing {} from {}.{}'.format(module_short, namespace, module_short)) return getattr(mod, 'Module')(config, theme) except ImportError as e: - log.fatal('failed to import {}: {}'.format(module_short, e)) - if not error or module_short in error: - error = str(e) + error = e log.fatal('failed to import {}: {}'.format(module_name, error)) return Error(config=config, module=module_name, error=error)