From cb70ff78406cfcf9951ff2cff58566ce58453eab Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Thu, 8 Nov 2012 11:35:53 -0500
Subject: [PATCH] Don't let cache failure break translator.

---
 module/VuFind/config/module.config.php | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php
index 6d166c61561..519711babd3 100644
--- a/module/VuFind/config/module.config.php
+++ b/module/VuFind/config/module.config.php
@@ -394,9 +394,19 @@ $config = array(
                 );
 
                 // Set up language caching for better performance:
-                $translator->setCache(
-                    $sm->get('VuFind\CacheManager')->getCache('language')
-                );
+                try {
+                    $translator->setCache(
+                        $sm->get('VuFind\CacheManager')->getCache('language')
+                    );
+                } catch (\Exception $e) {
+                    // Don't let a cache failure kill the whole application, but make
+                    // note of it:
+                    $logger = $sm->get('VuFind\Logger');
+                    $logger->debug(
+                        'Problem loading cache: ' . get_class($e) . ' exception: '
+                        . $e->getMessage()
+                    );
+                }
 
                 return $translator;
             },
-- 
GitLab