Skip to content

Commit

Permalink
raising exception during async init does not stop the app anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
byewokko committed Dec 4, 2024
1 parent 3e1df17 commit db96b90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions asab/web/auth/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 1 addition & 2 deletions asab/web/tenant/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db96b90

Please sign in to comment.