From db96b903d459d9021a4a850cf6d5a5bcf9631e31 Mon Sep 17 00:00:00 2001 From: "robin.hruska@teskalabs.com" Date: Wed, 4 Dec 2024 15:16:30 +0100 Subject: [PATCH] raising exception during async init does not stop the app anyway --- asab/web/auth/service.py | 6 ++++-- asab/web/tenant/service.py | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/asab/web/auth/service.py b/asab/web/auth/service.py index cc202a2f..71db5620 100644 --- a/asab/web/auth/service.py +++ b/asab/web/auth/service.py @@ -554,8 +554,10 @@ def _validate_wrapper_installation(self): # Ensure the wrappers are applied in the correct order tenant_wrapper_idx = tenant_service.get_web_wrapper_position(web_container) if tenant_wrapper_idx is not None and auth_wrapper_idx > tenant_wrapper_idx: - raise RuntimeError( - "TenantService.install(web_container) must be called before AuthService.install(web_container)") + L.error( + "TenantService.install(web_container) must be called before AuthService.install(web_container). " + "Otherwise authorization will not work properly." + ) if not auth_wrapper_installed: L.warning( diff --git a/asab/web/tenant/service.py b/asab/web/tenant/service.py index b1089013..c1bb77d8 100644 --- a/asab/web/tenant/service.py +++ b/asab/web/tenant/service.py @@ -55,14 +55,13 @@ def _prepare_providers(self): async def initialize(self, app): if len(self.Providers) == 0: - raise RuntimeError( + raise L.error( "TenantService requires at least one provider. " "Specify either `tenant_url` or `ids` in the [tenants] config section." ) for provider in self.Providers: await provider.initialize(app) - print(self.Tenants) @property