From 634866dd0cecb0190d591cda019ba52ce0b9c5a8 Mon Sep 17 00:00:00 2001 From: Matt Tuchfarber Date: Thu, 14 Mar 2019 11:15:25 -0400 Subject: [PATCH] Don't count a non-existing forums user as a failure --- lms/djangoapps/discussion_api/views.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lms/djangoapps/discussion_api/views.py b/lms/djangoapps/discussion_api/views.py index 49817e620b..7655f82cb5 100644 --- a/lms/djangoapps/discussion_api/views.py +++ b/lms/djangoapps/discussion_api/views.py @@ -658,12 +658,20 @@ class ReplaceUsernamesView(APIView): ) return True except comment_client.CommentClientRequestError as exc: - log.exception( - u"Unable to change username from %s to %s in forums because forums API call failed with: %s.", - current_username, - new_username, - exc, - ) + if exc.status_code == 404: + log.info( + u"Unable to change username from %s to %s in forums because user doesn't exist in forums", + current_username, + new_username, + ) + return True + else: + log.exception( + u"Unable to change username from %s to %s in forums because forums API call failed with: %s.", + current_username, + new_username, + exc, + ) return False log.info(