Skip to content

Commit

Permalink
Merge pull request #12303 from totten/master-redis-errmsg
Browse files Browse the repository at this point in the history
(dev/core#178) Redis - Report error messages
  • Loading branch information
colemanw authored Jun 14, 2018
2 parents 412f2d1 + aed6cc2 commit b782c36
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CRM/Utils/Cache/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b782c36

Please sign in to comment.