From b88aff6c8b1118ed35f2800a75362e99ee80742c Mon Sep 17 00:00:00 2001
From: Dorian Merz <merz@ub.uni-leipzig.de>
Date: Fri, 17 Jan 2020 13:21:43 +0100
Subject: [PATCH] refs #16762 [master] fixup in Ebsco Recommend

* do not throw Exception on parse error
* avoids breakdown of search results page
---
 module/finc/src/finc/Recommend/EbscoResults.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/module/finc/src/finc/Recommend/EbscoResults.php b/module/finc/src/finc/Recommend/EbscoResults.php
index fce9d9dab75..79a0b5c845b 100644
--- a/module/finc/src/finc/Recommend/EbscoResults.php
+++ b/module/finc/src/finc/Recommend/EbscoResults.php
@@ -163,12 +163,17 @@ class EbscoResults implements \VuFind\Recommend\RecommendInterface,
 
         if (!$results->isSuccess()) {
             $this->results = false;
+            return;
         }
         $this->results = $this->sortByHits(
             json_decode($results->getBody(), true)
         );
         if (json_last_error() !== JSON_ERROR_NONE) {
-            throw new \Exception('JSON type error ' . json_last_error_msg());
+            $this->debug(
+                'JSON type error "'
+                . json_last_error_msg().'"'
+                . (empty($results->getBody()) ? '. EBSCO result was empty.' : '')
+            );
         }
     }
 
-- 
GitLab