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)
{
_logger.Warn(e, "Unexpected error getting author info");
throw new AuthorNotFoundException(foreignAuthorId);
_logger.Warn(e, "Unexpected error getting author info: {foreignAuthorId}", foreignAuthorId);
throw;
}
}
@ -126,8 +126,8 @@ public Tuple<string, Book, List<AuthorMetadata>> GetBookInfo(string foreignBookI
}
catch (BookInfoException e)
{
_logger.Warn(e, "Unexpected error getting book info");
throw new BookNotFoundException(foreignBookId);
_logger.Warn(e, "Unexpected error getting book info: {foreignBookId}", foreignBookId);
throw;
}
}
@ -430,7 +430,7 @@ private Book GetEditionInfo(int id, bool getAllEditions)
{
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 };
}
else if (type == "work")