Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
Print failed ID list
Browse files Browse the repository at this point in the history
  • Loading branch information
mparent61 committed Mar 2, 2016
1 parent 64b8b31 commit 8ba93a0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions videohub_client/management/commands/migrate_channel_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def add_arguments(self, parser):
def handle(self, *args, **options):

# If any video fails, continue trying the rest before we raise error
failed = False
failed = []
for video in VideohubVideo.objects.filter(channel_id__isnull=True):

url = video.get_api_url()
Expand Down Expand Up @@ -51,7 +51,9 @@ def handle(self, *args, **options):
url,
resp.status_code,
resp.reason)))
failed = True
failed.append(video)

if failed:
raise CommandError('Failed to update 1 or more videos')
raise CommandError('Failed to update {} video(s): {}'.format(
len(failed),
[f.id for f in failed]))

0 comments on commit 8ba93a0

Please sign in to comment.