summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolai Søborg <NicolaiSoeborg@users.noreply.github.com>2020-11-11 14:24:53 +0100
committerGitHub <noreply@github.com>2020-11-11 13:24:53 +0000
commit4c7587ef99e8057960a0d9cd3c50e73b90e3c9ae (patch)
tree1e91fb295e43dd04b550f1abc15bc2d1ddcaf932
parentNotes on SSO logins and media_repository worker (#8701) (diff)
downloadsynapse-4c7587ef99e8057960a0d9cd3c50e73b90e3c9ae.tar.xz
Catch exceptions in password_providers (#8636)
Signed-off-by: Nicolai Søborg <git@xn--sb-lka.org>
-rw-r--r--changelog.d/8636.misc1
-rw-r--r--synapse/handlers/auth.py13
2 files changed, 10 insertions, 4 deletions
diff --git a/changelog.d/8636.misc b/changelog.d/8636.misc
new file mode 100644
index 0000000000..df4dca42f8
--- /dev/null
+++ b/changelog.d/8636.misc
@@ -0,0 +1 @@
+Catch exceptions during initialization of `password_providers`. Contributed by Nicolai Søborg.
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py
index ff103cbb92..213baea2e3 100644
--- a/synapse/handlers/auth.py
+++ b/synapse/handlers/auth.py
@@ -181,10 +181,15 @@ class AuthHandler(BaseHandler):
         #   better way to break the loop
         account_handler = ModuleApi(hs, self)
 
-        self.password_providers = [
-            module(config=config, account_handler=account_handler)
-            for module, config in hs.config.password_providers
-        ]
+        self.password_providers = []
+        for module, config in hs.config.password_providers:
+            try:
+                self.password_providers.append(
+                    module(config=config, account_handler=account_handler)
+                )
+            except Exception as e:
+                logger.error("Error while initializing %r: %s", module, e)
+                raise
 
         logger.info("Extra password_providers: %r", self.password_providers)