/** * @param Exception $e the Exception that was thrown * @param string $command the command that was being executed * @param array $args the arguments of the command * @throws \Plista\Core\Redis\Exception * @return bool */ private function handleException(Exception $e, $command, $args) { $excBrief = "{$e->getCode()}: {$e->getMessage()} ({$e->getFile()}:{$e->getLine()}) Stacktrace:\n" . $e->getTraceAsString(); // $excHash = md5($excBrief); // $curTime = Registry::getSystem()->getTime()->current(); // // $this->excLog[$excHash]['count']++; // $this->excLog[$excHash]['time'] = $curTime; // log the exception $this->log->warning("Caught Redis exception: {$excBrief}"); if ($this->exceptionHandler) { // notify the handler and get the strategy $context = ExceptionContext::fromFunctionAndArguments($command, $args); $strategy = $this->exceptionHandler->handleException($e, $context); } else { // use the default strategy $strategy = $this->defaultHandlerStrategy; } // default is to discard the exception if (!$strategy) { $strategy = ExceptionStrategy::DISCARD(); } // let's see what the handler wants us to do if ($strategy->equals(ExceptionStrategy::RETHROW)) { throw $e; } // this case is used by the FailoverWrapper if ($strategy->equals(ExceptionStrategy::RETURN_VALUE)) { return $strategy->returnValue; } // return false to signal failure. maybe interpreted by some callers as a valid value (which it // is in some cases), but that's not for us to worry about. return false; }