Merge pull request #209 from mouse-reeve/connector-errors

Raise errors when connectors fail
This commit is contained in:
Mouse Reeve
2020-10-01 08:29:39 -07:00
committed by GitHub
6 changed files with 20 additions and 8 deletions

View File

@ -9,6 +9,10 @@ from django.db import transaction
from bookwyrm import models
class ConnectorException(Exception):
''' when the connector can't do what was asked '''
class AbstractConnector(ABC):
''' generic book data connector '''
@ -128,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