Skip to content

Commit 624d563

Browse files
igobrancosandroscosta
authored andcommitted
feat: add exception message has localizedMessage
GN-1088 FAN-41
1 parent e225cd0 commit 624d563

File tree

1 file changed

+8
-0
lines changed
  • openedx/core/djangoapps/enrollments

1 file changed

+8
-0
lines changed

openedx/core/djangoapps/enrollments/views.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,14 @@ def post(self, request):
868868

869869
log.info("The user [%s] has already been enrolled in course run [%s].", username, course_id)
870870
return Response(response)
871+
except InvalidEnrollmentAttribute as error:
872+
return Response(
873+
status=status.HTTP_400_BAD_REQUEST,
874+
data={
875+
"message": str(error),
876+
"localizedMessage": str(error),
877+
}
878+
)
871879
except CourseModeNotFoundError as error:
872880
return Response(
873881
status=status.HTTP_400_BAD_REQUEST,

0 commit comments

Comments
 (0)