diff --git a/CRM/Utils/Cache/Redis.php b/CRM/Utils/Cache/Redis.php index d64a81667f6..0cfccdf80f0 100644 --- a/CRM/Utils/Cache/Redis.php +++ b/CRM/Utils/Cache/Redis.php @@ -119,7 +119,13 @@ public function __construct($config) { */ public function set($key, &$value) { if (!$this->_cache->set($this->_prefix . $key, serialize($value), $this->_timeout)) { - CRM_Core_Error::fatal("Redis set failed, wondering why?, $key", $value); + if (PHP_SAPI === 'cli' || (Civi\Core\Container::isContainerBooted() && CRM_Core_Permission::check('view debug output'))) { + CRM_Core_Error::fatal("Redis set ($key) failed: " . $this->_cache->getLastError()); + } + else { + Civi::log()->error("Redis set ($key) failed: " . $this->_cache->getLastError()); + CRM_Core_Error::fatal("Redis set ($key) failed"); + } return FALSE; } return TRUE;