More error handling in connector/books manager
This commit is contained in:
parent
fe83f5d442
commit
94d5986ff2
|
@ -26,8 +26,10 @@ def get_or_create_book(remote_id):
|
||||||
|
|
||||||
connector = get_or_create_connector(remote_id)
|
connector = get_or_create_connector(remote_id)
|
||||||
|
|
||||||
|
# raises ConnectorException
|
||||||
book = connector.get_or_create_book(remote_id)
|
book = connector.get_or_create_book(remote_id)
|
||||||
load_more_data.delay(book.id)
|
if book:
|
||||||
|
load_more_data.delay(book.id)
|
||||||
return book
|
return book
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,9 @@ class AbstractConnector(ABC):
|
||||||
edition.author_text = work.author_text
|
edition.author_text = work.author_text
|
||||||
edition.save()
|
edition.save()
|
||||||
|
|
||||||
|
if not edition:
|
||||||
|
raise ConnectorException('Unable to create book: %s' % remote_id)
|
||||||
|
|
||||||
return edition
|
return edition
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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):
|
def is_work_data(self, data):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue