From 75605b5f03dad912ab2277e59e562e9593a013f7 Mon Sep 17 00:00:00 2001 From: Unrud Date: Thu, 15 Jun 2017 23:54:32 +0200 Subject: [PATCH] Catch all exceptions when loading plugins --- radicale/auth.py | 6 +++--- radicale/rights.py | 6 +++--- radicale/storage.py | 6 +++--- radicale/web.py | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/radicale/auth.py b/radicale/auth.py index 20c1399..29124c5 100644 --- a/radicale/auth.py +++ b/radicale/auth.py @@ -75,9 +75,9 @@ def load(configuration, logger): else: try: class_ = import_module(auth_type).Auth - except ImportError as e: - raise RuntimeError("Authentication module %r not found" % - auth_type) from e + except Exception as e: + raise RuntimeError("Failed to load authentication module %r: %s" % + (auth_type, e)) from e logger.info("Authentication type is %r", auth_type) return class_(configuration, logger) diff --git a/radicale/rights.py b/radicale/rights.py index ed8745b..eedae7c 100644 --- a/radicale/rights.py +++ b/radicale/rights.py @@ -63,9 +63,9 @@ def load(configuration, logger): else: try: rights_class = import_module(rights_type).Rights - except ImportError as e: - raise RuntimeError("Rights module %r not found" % - rights_type) from e + except Exception as e: + raise RuntimeError("Failed to load rights module %r: %s" % + (rights_type, e)) from e logger.info("Rights type is %r", rights_type) return rights_class(configuration, logger).authorized diff --git a/radicale/storage.py b/radicale/storage.py index de32851..3d647be 100644 --- a/radicale/storage.py +++ b/radicale/storage.py @@ -101,9 +101,9 @@ def load(configuration, logger): else: try: collection_class = import_module(storage_type).Collection - except ImportError as e: - raise RuntimeError("Storage module %r not found" % - storage_type) from e + except Exception as e: + raise RuntimeError("Failed to load storage module %r: %s" % + (storage_type, e)) from e logger.info("Storage type is %r", storage_type) class CollectionCopy(collection_class): diff --git a/radicale/web.py b/radicale/web.py index 96d30e5..bc8364c 100644 --- a/radicale/web.py +++ b/radicale/web.py @@ -55,9 +55,9 @@ def load(configuration, logger): else: try: web_class = import_module(web_type).Web - except ImportError as e: - raise RuntimeError("Web module %r not found" % - web_type) from e + except Exception as e: + raise RuntimeError("Failed to load web module %r: %s" % + (web_type, e)) from e logger.info("Web type is %r", web_type) return web_class(configuration, logger)