diff --git a/authentik/flows/views.py b/authentik/flows/views.py index 437857dff..c843a88a6 100644 --- a/authentik/flows/views.py +++ b/authentik/flows/views.py @@ -14,6 +14,7 @@ from drf_yasg import openapi from drf_yasg.utils import no_body, swagger_auto_schema from rest_framework.permissions import AllowAny from rest_framework.views import APIView +from sentry_sdk import capture_exception from structlog.stdlib import BoundLogger, get_logger from authentik.core.models import USER_ATTRIBUTE_DEBUG @@ -152,7 +153,8 @@ class FlowExecutorView(APIView): stage_response = self.current_stage_view.get(request, *args, **kwargs) return to_stage_response(request, stage_response) except Exception as exc: # pylint: disable=broad-except - self._logger.exception(exc) + capture_exception(exc) + self._logger.warning(exc) return to_stage_response(request, FlowErrorResponse(request, exc)) @swagger_auto_schema( @@ -180,7 +182,8 @@ class FlowExecutorView(APIView): stage_response = self.current_stage_view.post(request, *args, **kwargs) return to_stage_response(request, stage_response) except Exception as exc: # pylint: disable=broad-except - self._logger.exception(exc) + capture_exception(exc) + self._logger.warning(exc) return to_stage_response(request, FlowErrorResponse(request, exc)) def _initiate_plan(self) -> FlowPlan: diff --git a/authentik/providers/oauth2/views/authorize.py b/authentik/providers/oauth2/views/authorize.py index 538595ec0..9c8437a18 100644 --- a/authentik/providers/oauth2/views/authorize.py +++ b/authentik/providers/oauth2/views/authorize.py @@ -304,7 +304,7 @@ class OAuthFulfillmentStage(StageView): return urlunsplit(uri) raise OAuth2Error() except OAuth2Error as error: - LOGGER.exception("Error when trying to create response uri", error=error) + LOGGER.warning("Error when trying to create response uri", error=error) raise AuthorizeError( self.params.redirect_uri, "server_error",