From 80685afa7e5665543a0d41d464400bbc51c9aa82 Mon Sep 17 00:00:00 2001 From: mikiher Date: Mon, 9 Sep 2024 19:23:26 +0300 Subject: [PATCH] Add a try-catch block around custom provider search --- server/finders/BookFinder.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/finders/BookFinder.js b/server/finders/BookFinder.js index 8aef4d11..47d1118c 100644 --- a/server/finders/BookFinder.js +++ b/server/finders/BookFinder.js @@ -202,10 +202,14 @@ class BookFinder { * @returns {Promise} */ 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 {