Introducing exception handling in the application code

This commit is contained in:
2017-08-25 11:47:40 +02:00
parent 6edd0e2f8d
commit a12838032f
2 changed files with 24 additions and 5 deletions

View File

@@ -93,8 +93,13 @@ class OAuthSignIn(metaclass=abc.ABCMeta):
cls._providers = {}
# TODO convert to the new __init_subclass__
for provider_class in cls.__subclasses__():
provider = provider_class()
cls._providers[provider.provider_name] = provider
try:
provider = provider_class()
except ProviderConfigurationMissing:
# TODO: log this at info level
pass
else:
cls._providers[provider.provider_name] = provider
try:
return cls._providers[provider_name]
except KeyError: