Fixed: Don't treat metadata errors as missing author/book entities

This commit is contained in:
Bogdan 2025-06-16 21:11:00 +03:00
parent f53c4dc017
commit 0f3e716044

View file

@ -103,8 +103,8 @@ public Author GetAuthorInfo(string foreignAuthorId, bool useCache = true)
} }
catch (BookInfoException e) catch (BookInfoException e)
{ {
_logger.Warn(e, "Unexpected error getting author info"); _logger.Warn(e, "Unexpected error getting author info: {foreignAuthorId}", foreignAuthorId);
throw new AuthorNotFoundException(foreignAuthorId); throw;
} }
} }
@ -126,8 +126,8 @@ public Tuple<string, Book, List<AuthorMetadata>> GetBookInfo(string foreignBookI
} }
catch (BookInfoException e) catch (BookInfoException e)
{ {
_logger.Warn(e, "Unexpected error getting book info"); _logger.Warn(e, "Unexpected error getting book info: {foreignBookId}", foreignBookId);
throw new BookNotFoundException(foreignBookId); throw;
} }
} }
@ -430,7 +430,7 @@ private Book GetEditionInfo(int id, bool getAllEditions)
{ {
var author = PollAuthor(newId); var author = PollAuthor(newId);
book = author.Books.Value.Where(b => b.Editions.Value.Any(e => e.ForeignEditionId == id.ToString())).FirstOrDefault(); book = author.Books.Value.FirstOrDefault(b => b.Editions.Value.Any(e => e.ForeignEditionId == id.ToString()));
authors = new List<AuthorMetadata> { author.Metadata.Value }; authors = new List<AuthorMetadata> { author.Metadata.Value };
} }
else if (type == "work") else if (type == "work")