diff --git a/common/djangoapps/student/views/management.py b/common/djangoapps/student/views/management.py index 0f8be8ff9b56..02940da78f3b 100644 --- a/common/djangoapps/student/views/management.py +++ b/common/djangoapps/student/views/management.py @@ -423,8 +423,8 @@ def change_enrollment(request, check_access=True): enroll_mode = CourseMode.auto_enroll_mode(course_id, available_modes) if enroll_mode: CourseEnrollment.enroll(user, course_id, check_access=check_access, mode=enroll_mode) - except EnrollmentNotAllowed as exec: # pylint: disable=broad-except - return HttpResponseBadRequest(str(exec)) + except EnrollmentNotAllowed as exc: + return HttpResponseBadRequest(str(exc)) except Exception: # pylint: disable=broad-except return HttpResponseBadRequest(_("Could not enroll"))