From c73f23550810501a4072be71f4c2e07ee334597d Mon Sep 17 00:00:00 2001 From: "waleed.mujahid" Date: Fri, 11 Jul 2025 10:34:51 +0500 Subject: [PATCH] fix: include error_code in PreventRegistration exception response The Authn MFE relies on the `error_code` in API responses to display appropriate error messages to users. Although the PreventRegistration exception already supports `error_code`, it was not previously included in the API response payload. This change ensures that `error_code` is returned in the response when a PreventRegistration exception is raised, allowing the frontend to handle errors more accurately. --- openedx/core/djangoapps/user_authn/views/register.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/user_authn/views/register.py b/openedx/core/djangoapps/user_authn/views/register.py index ab57687d2cd4..5af0d1c9a763 100644 --- a/openedx/core/djangoapps/user_authn/views/register.py +++ b/openedx/core/djangoapps/user_authn/views/register.py @@ -590,7 +590,7 @@ def post(self, request): errors = { "error_message": [{"user_message": str(exc)}], } - return self._create_response(request, errors, status_code=exc.status_code) + return self._create_response(request, errors, status_code=exc.status_code, error_code=exc.error_code) response = self._handle_duplicate_email_username(request, data) if response: