Better exception log

This commit is contained in:
allegroai 2021-01-05 18:36:25 +02:00
parent b9cb587580
commit f879f6924f

View File

@ -78,7 +78,7 @@ def validate_auth(endpoint, call):
auth_type, _, auth_data = auth.partition(" ") auth_type, _, auth_data = auth.partition(" ")
authorize_func = get_auth_func(auth_type) authorize_func = get_auth_func(auth_type)
call.auth = authorize_func(auth_data, service, action, call.batched_data) call.auth = authorize_func(auth_data, service, action, call.batched_data)
except Exception as e: except Exception:
if endpoint.authorize: if endpoint.authorize:
# if endpoint requires authorization, re-raise exception # if endpoint requires authorization, re-raise exception
raise raise
@ -86,7 +86,7 @@ def validate_auth(endpoint, call):
def validate_impersonation(endpoint, call): def validate_impersonation(endpoint, call):
""" Validate impersonation headers and set impersonated identity and authorization data accordingly. """ Validate impersonation headers and set impersonated identity and authorization data accordingly.
:returns True is impersonating, False otherwise :returns True if impersonating, False otherwise
""" """
try: try:
act_as = call.act_as act_as = call.act_as
@ -158,7 +158,8 @@ def validate_impersonation(endpoint, call):
except APIError: except APIError:
raise raise
except Exception: except Exception as ex:
log.exception(f"Validating impersonation: {str(ex)}")
raise errors.server_error.InternalError("validating impersonation") raise errors.server_error.InternalError("validating impersonation")