Merge pull request #3396 from mikiher/custom-provider-try-catch

Add a try-catch block around custom provider search
This commit is contained in:
advplyr 2024-09-09 16:04:20 -05:00 committed by GitHub
commit 7a0cd1eb34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 {