Add logging when author normalization is empty

This commit is contained in:
Nicholas Wallace 2026-05-13 14:16:30 -07:00
parent 6b97fc0ce6
commit c814a84b27
3 changed files with 12 additions and 2 deletions

View file

@ -480,7 +480,10 @@ class Book extends Model {
const authorsAdded = []
for (const authorName of newAuthorNames) {
const { author, created } = await authorModel.findOrCreateByNameAndLibrary(authorName, libraryId)
if (!author) continue
if (!author) {
Logger.warn(`[Book] "${this.title}" skipped author "${authorName}" because normalized name was empty`)
continue
}
await bookAuthorModel.create({ bookId: this.id, authorId: author.id })
if (created) {
SocketAuthority.emitter('author_added', author.toOldJSON())