Skip to content

Commit

Permalink
Merge pull request #3396 from mikiher/custom-provider-try-catch
Browse files Browse the repository at this point in the history
Add a try-catch block around custom provider search
  • Loading branch information
advplyr authored Sep 9, 2024
2 parents ac3277d + 80685af commit 7a0cd1e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server/finders/BookFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,14 @@ class BookFinder {
* @returns {Promise<Object[]>}
*/
async getCustomProviderResults(title, author, isbn, providerSlug) {
const books = await this.customProviderAdapter.search(title, author, isbn, providerSlug, 'book', this.#providerResponseTimeout)
if (this.verbose) Logger.debug(`Custom provider '${providerSlug}' Search Results: ${books.length || 0}`)

return books
try {
const books = await this.customProviderAdapter.search(title, author, isbn, providerSlug, 'book', this.#providerResponseTimeout)
if (this.verbose) Logger.debug(`Custom provider '${providerSlug}' Search Results: ${books.length || 0}`)
return books
} catch (error) {
Logger.error(`Error searching Custom provider '${providerSlug}':`, error)
return []
}
}

static TitleCandidates = class {
Expand Down

0 comments on commit 7a0cd1e

Please sign in to comment.