From d8e6b3e6a8fc48b0eff3a7566aea708a1ed631f6 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Mon, 9 Jul 2018 11:48:06 -0400
Subject: [PATCH] Improved exception handling. - Solr connection failure should
 trigger a BackendException so the record loader can work around it when in
 "tolerate backend exceptions" mode.

---
 .../src/VuFindSearch/Backend/Solr/Connector.php            | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php
index c203169bfc1..50ba704fa1a 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Connector.php
@@ -32,6 +32,7 @@ namespace VuFindSearch\Backend\Solr;
 
 use InvalidArgumentException;
 
+use VuFindSearch\Backend\Exception\BackendException;
 use VuFindSearch\Backend\Exception\HttpErrorException;
 
 use VuFindSearch\Backend\Exception\RequestErrorException;
@@ -410,9 +411,9 @@ class Connector implements \Zend\Log\LoggerAwareInterface
             }
         }
 
-        // If we got this far, everything failed -- throw the most recent
-        // exception caught above.
-        throw $exception;
+        // If we got this far, everything failed -- throw a BackendException with
+        // the most recent exception caught above set as the previous exception.
+        throw new BackendException('Problem connecting to Solr.', null, $exception);
     }
 
     /**
-- 
GitLab