From 02ecf7ccfe4c67678022003cd691f6e16a21d0e8 Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 8 Jan 2025 16:53:56 -0600 Subject: [PATCH] Fix catch exception on failed to parse comic metadata #3804 --- server/utils/comicBookExtractors.js | 10 ++++++++-- server/utils/parsers/parseComicMetadata.js | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/server/utils/comicBookExtractors.js b/server/utils/comicBookExtractors.js index 9c18ebddc2..6fc3739211 100644 --- a/server/utils/comicBookExtractors.js +++ b/server/utils/comicBookExtractors.js @@ -189,8 +189,14 @@ class CbzStreamZipComicBookExtractor extends AbstractComicBookExtractor { } close() { - this.archive?.close() - Logger.debug(`[CbzStreamZipComicBookExtractor] Closed comic book "${this.comicPath}"`) + this.archive + ?.close() + .then(() => { + Logger.debug(`[CbzStreamZipComicBookExtractor] Closed comic book "${this.comicPath}"`) + }) + .catch((error) => { + Logger.error(`[CbzStreamZipComicBookExtractor] Failed to close comic book "${this.comicPath}"`, error) + }) } } diff --git a/server/utils/parsers/parseComicMetadata.js b/server/utils/parsers/parseComicMetadata.js index 38a41b51d8..85988ffc5a 100644 --- a/server/utils/parsers/parseComicMetadata.js +++ b/server/utils/parsers/parseComicMetadata.js @@ -43,7 +43,9 @@ async function parse(ebookFile) { archive = createComicBookExtractor(comicPath) await archive.open() - const filePaths = await archive.getFilePaths() + const filePaths = await archive.getFilePaths().catch((error) => { + Logger.error(`[parseComicMetadata] Failed to get file paths from comic at "${comicPath}"`, error) + }) // Sort the file paths in a natural order to get the first image filePaths.sort((a, b) => {