Safely handle work with no editions error

This commit is contained in:
Mouse Reeve 2021-08-23 15:59:58 -07:00
parent 016930fd0c
commit 332a712d84

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))