Skip to content

Commit

Permalink
refactor: Log exceptions in apple user migration (openedx#32987)
Browse files Browse the repository at this point in the history
  • Loading branch information
moeez96 committed Aug 11, 2023
1 parent 9743e80 commit 9123602
Showing 1 changed file with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,18 @@ def handle(self, *args, **options):
).first()
if user_social_auth:
with transaction.atomic():
user_social_auth.uid = apple_user_id_info.new_apple_id
user_social_auth.save()
log.info(
'Replaced Apple ID %s with %s',
apple_user_id_info.old_apple_id,
apple_user_id_info.new_apple_id
)
try:
user_social_auth.uid = apple_user_id_info.new_apple_id
user_social_auth.save()
log.info(
'Replaced Apple ID %s with %s',
apple_user_id_info.old_apple_id,
apple_user_id_info.new_apple_id
)
except Exception as e: # pylint: disable=broad-except
log.error(
'An error occurred while replacing %s with %s. Error: %s',
apple_user_id_info.old_apple_id,
apple_user_id_info.new_apple_id,
str(e)
)

0 comments on commit 9123602

Please sign in to comment.