Skip to content

Commit

Permalink
Fix catch exception on failed to parse comic metadata #3804
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Jan 8, 2025
1 parent 05ff5f1 commit 02ecf7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions server/utils/comicBookExtractors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
}

Expand Down
4 changes: 3 additions & 1 deletion server/utils/parsers/parseComicMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 02ecf7c

Please sign in to comment.