Merge pull request #1107 from bookwyrm-social/no-edition-case

Correctly handles openlibrary works with no editions
This commit is contained in:
Mouse Reeve 2021-05-20 15:56:36 -07:00 committed by GitHub
commit 8609c8eb79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,7 +76,10 @@ class Connector(AbstractConnector):
raise ConnectorException("Invalid book data") raise ConnectorException("Invalid book data")
url = "%s%s/editions" % (self.books_url, key) url = "%s%s/editions" % (self.books_url, key)
data = get_data(url) data = get_data(url)
return pick_default_edition(data["entries"]) edition = pick_default_edition(data["entries"])
if not edition:
raise ConnectorException("No editions for work")
return edition
def get_work_from_edition_data(self, data): def get_work_from_edition_data(self, data):
try: try: