refactor: Adding some debug logs. (#29639)

This commit is contained in:
Awais Jibran
2021-12-20 18:26:10 +05:00
committed by GitHub
parent c727359a37
commit 80e12af963

View File

@@ -129,8 +129,16 @@ def get_course_overview_with_access(user, action, course_key, check_if_enrolled=
try:
course_overview = CourseOverview.get_from_id(course_key)
except CourseOverview.DoesNotExist:
log.exception(f'Failed to retrieve course from courseoverview."{course_key}"')
raise Http404("Course not found.") # lint-amnesty, pylint: disable=raise-missing-from
course_under_investigation = str(course_key) == 'course-v1:UQx+ABLE301x+1T2022'
if course_under_investigation:
log.info('[TNL_9420] Course overview found, Checking course access.')
check_course_access_with_redirect(course_overview, user, action, check_if_enrolled)
if course_under_investigation:
log.info('[TNL_9420] Course access granted')
return course_overview
@@ -233,6 +241,9 @@ def check_course_access_with_redirect(course, user, action, check_if_enrolled=Fa
# Deliberately return a non-specific error message to avoid
# leaking info about access control settings
log.exception(
f'[TNL_9420] Failed to grant course access for "{course.id}", {access_response.to_json()}'
)
raise CoursewareAccessException(access_response)