From f879f6924f573aeec9422e8f6843707dc3ee5c29 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Tue, 5 Jan 2021 18:36:25 +0200 Subject: [PATCH] Better exception log --- apiserver/service_repo/validators.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apiserver/service_repo/validators.py b/apiserver/service_repo/validators.py index da3eb45..4e1ca86 100644 --- a/apiserver/service_repo/validators.py +++ b/apiserver/service_repo/validators.py @@ -78,7 +78,7 @@ def validate_auth(endpoint, call): auth_type, _, auth_data = auth.partition(" ") authorize_func = get_auth_func(auth_type) call.auth = authorize_func(auth_data, service, action, call.batched_data) - except Exception as e: + except Exception: if endpoint.authorize: # if endpoint requires authorization, re-raise exception raise @@ -86,7 +86,7 @@ def validate_auth(endpoint, call): def validate_impersonation(endpoint, call): """ Validate impersonation headers and set impersonated identity and authorization data accordingly. - :returns True is impersonating, False otherwise + :returns True if impersonating, False otherwise """ try: act_as = call.act_as @@ -158,7 +158,8 @@ def validate_impersonation(endpoint, call): except APIError: raise - except Exception: + except Exception as ex: + log.exception(f"Validating impersonation: {str(ex)}") raise errors.server_error.InternalError("validating impersonation")