Merge pull request #1330 from bookwyrm-social/resolve-book-errors

Safely handle work with no editions error
This commit is contained in:
Mouse Reeve 2021-08-23 17:26:08 -06:00 committed by GitHub
commit 6115ead363
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -145,8 +145,8 @@ class Connector(AbstractConnector):
def get_edition_from_work_data(self, data):
data = self.load_edition_data(data.get("uri"))
try:
uri = data["uris"][0]
except KeyError:
uri = data.get("uris", [])[0]
except IndexError:
raise ConnectorException("Invalid book data")
return self.get_book_data(self.get_remote_id(uri))