diff --git a/bookwyrm/books_manager.py b/bookwyrm/books_manager.py index c18e6361..bfc543de 100644 --- a/bookwyrm/books_manager.py +++ b/bookwyrm/books_manager.py @@ -26,8 +26,10 @@ def get_or_create_book(remote_id): connector = get_or_create_connector(remote_id) + # raises ConnectorException book = connector.get_or_create_book(remote_id) - load_more_data.delay(book.id) + if book: + load_more_data.delay(book.id) return book diff --git a/bookwyrm/connectors/abstract_connector.py b/bookwyrm/connectors/abstract_connector.py index 387b994f..9d687a80 100644 --- a/bookwyrm/connectors/abstract_connector.py +++ b/bookwyrm/connectors/abstract_connector.py @@ -132,6 +132,9 @@ class AbstractConnector(ABC): edition.author_text = work.author_text edition.save() + if not edition: + raise ConnectorException('Unable to create book: %s' % remote_id) + return edition diff --git a/bookwyrm/connectors/self_connector.py b/bookwyrm/connectors/self_connector.py index e1317597..2711bb1a 100644 --- a/bookwyrm/connectors/self_connector.py +++ b/bookwyrm/connectors/self_connector.py @@ -50,10 +50,6 @@ class Connector(AbstractConnector): ) - def get_or_create_book(self, remote_id): - ''' this COULD be semi-implemented but I think it shouldn't be used ''' - - def is_work_data(self, data): pass