From 799496bb86ffb6d69d97cfcc1279438bf1f9451a Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 12 Nov 2020 13:33:12 -0800 Subject: [PATCH] Move past all book loading exceptions during import --- bookwyrm/goodreads_import.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bookwyrm/goodreads_import.py b/bookwyrm/goodreads_import.py index fe5ac56e..ee949630 100644 --- a/bookwyrm/goodreads_import.py +++ b/bookwyrm/goodreads_import.py @@ -20,7 +20,7 @@ def create_job(user, csv_file, include_reviews, privacy): ) for index, entry in enumerate(list(csv.DictReader(csv_file))[:MAX_ENTRIES]): if not all(x in entry for x in ('ISBN13', 'Title', 'Author')): - raise ValueError("Author, title, and isbn must be in data.") + raise ValueError('Author, title, and isbn must be in data.') ImportItem(job=job, index=index, data=entry).save() return job @@ -41,8 +41,9 @@ def import_data(job_id): for item in job.items.all(): try: item.resolve() - except HTTPError: - pass + except: + item.fail_reason = 'Error loading book' + item.save() if item.book: item.save() results.append(item) @@ -51,7 +52,7 @@ def import_data(job_id): outgoing.handle_imported_book( job.user, item, job.include_reviews, job.privacy) else: - item.fail_reason = "Could not find a match for book" + item.fail_reason = 'Could not find a match for book' item.save() finally: create_notification(job.user, 'IMPORT', related_import=job)