Add a try-catch block around custom provider search

This commit is contained in:
mikiher 2024-09-09 19:23:26 +03:00
parent 0344a63b48
commit 80685afa7e

View File

@ -202,10 +202,14 @@ class BookFinder {
* @returns {Promise<Object[]>} * @returns {Promise<Object[]>}
*/ */
async getCustomProviderResults(title, author, isbn, providerSlug) { async getCustomProviderResults(title, author, isbn, providerSlug) {
const books = await this.customProviderAdapter.search(title, author, isbn, providerSlug, 'book', this.#providerResponseTimeout) try {
if (this.verbose) Logger.debug(`Custom provider '${providerSlug}' Search Results: ${books.length || 0}`) 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 return books
} catch (error) {
Logger.error(`Error searching Custom provider '${providerSlug}':`, error)
return []
}
} }
static TitleCandidates = class { static TitleCandidates = class {