Skip to content

Commit

Permalink
Merge pull request openedx#34510 from openedx/pwnage101/add-debugging…
Browse files Browse the repository at this point in the history
…-force-enrollment

feat: add more verbose logging around force_enrollment
  • Loading branch information
pwnage101 authored Apr 15, 2024
2 parents 0270809 + f30ae71 commit 1244a9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions common/djangoapps/student/models/course_enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,10 @@ def enroll(cls, user, course_key, mode=None, check_access=False, can_upgrade=Fal
if check_access:
if cls.is_enrollment_closed(user, course) and not can_upgrade:
log.warning(
"User %s failed to enroll in course %s because enrollment is closed",
"User %s failed to enroll in course %s because enrollment is closed (can_upgrade=%s).",
user.username,
str(course_key)
str(course_key),
can_upgrade,
)
raise EnrollmentClosedError

Expand Down
3 changes: 2 additions & 1 deletion openedx/features/enterprise_support/enrollments/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ def lms_update_or_create_enrollment(
except (CourseEnrollmentError, CourseEnrollmentNotUpdatableError) as error:
log.exception(
"Raising error [%s] for user "
"[%s]: course run = [%s], enterprise_uuid = [%s], is_active = [%s], ",
"[%s]: course run = [%s], enterprise_uuid = [%s], is_active = [%s], force_enrollment = [%s], ",
error,
username,
course_id,
str(enterprise_uuid),
is_active,
force_enrollment,
)
raise error
finally:
Expand Down

0 comments on commit 1244a9f

Please sign in to comment.