From 71428366227e3026dcbdcb7df6dc42296b047813 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 31 May 2018 18:28:16 -0400 Subject: [PATCH] Adding exception handling to GoodreadsClient if site is down --- cps/web.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cps/web.py b/cps/web.py index f69e3855..efcd4653 100755 --- a/cps/web.py +++ b/cps/web.py @@ -1225,9 +1225,13 @@ def author(book_id, page): author_info = None other_books = [] if goodreads_support and config.config_use_goodreads: - gc = GoodreadsClient(config.config_goodreads_api_key, config.config_goodreads_api_secret) - author_info = gc.find_author(author_name=name) - other_books = get_unique_other_books(entries.all(), author_info.books) + try: + gc = GoodreadsClient(config.config_goodreads_api_key, config.config_goodreads_api_secret) + author_info = gc.find_author(author_name=name) + other_books = get_unique_other_books(entries.all(), author_info.books) + except: + # Skip goodreads, if site is down/inaccessible + pass return render_title_template('author.html', entries=entries, pagination=pagination, title=name, author=author_info, other_books=other_books)