Skip to content

Commit

Permalink
Add exception handling for download data responses failure (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsadDevAI authored Sep 22, 2021
1 parent a807315 commit 72ce3e1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lms/djangoapps/courseware/user_state_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import six
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.core.paginator import Paginator
from django.db import transaction
from django.db.utils import IntegrityError
Expand Down Expand Up @@ -425,6 +426,15 @@ def iter_all_for_block(self, block_key, scope=Scope.user_state):
if state == {}:
continue

try:
sm.student
except ObjectDoesNotExist:
log.warning(
'The related user in student module record with the student_id %s does not exist',
sm.student_id
)
continue

yield XBlockUserState(sm.student.username, sm.module_state_key, state, sm.modified, scope)

def iter_all_for_course(self, course_key, block_type=None, scope=Scope.user_state):
Expand Down

0 comments on commit 72ce3e1

Please sign in to comment.