From 4d4153c14f46c6bda63a3d7e0184960110185cf9 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Fri, 22 May 2020 13:18:11 -0400
Subject: [PATCH] Display exception message even if non-JSON.

---
 .../VuFindSearch/src/VuFindSearch/Backend/EDS/Connector.php   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Connector.php
index 5c089865155..2db6c4adb1c 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Connector.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/Connector.php
@@ -141,7 +141,9 @@ class Connector extends Base implements LoggerAwareInterface
         $this->client->setEncType($messageFormat);
         $result = $this->client->send();
         if (!$result->isSuccess()) {
-            throw new ApiException(json_decode($result->getBody(), true));
+            $error = $result->getBody();
+            $decodedError = json_decode($error, true);
+            throw new ApiException($decodedError ? $decodedError : $error);
         }
         return $result->getBody();
     }
-- 
GitLab