コード例 #1
0
 /**
  * Handles error responses returned by redis-sentinel.
  *
  * @param NodeConnectionInterface $sentinel Connection to a sentinel server.
  * @param ErrorResponseInterface  $error    Error response.
  */
 private function handleSentinelErrorResponse(NodeConnectionInterface $sentinel, ErrorResponseInterface $error)
 {
     if ($error->getErrorType() === 'IDONTKNOW') {
         throw new ConnectionException($sentinel, $error->getMessage());
     } else {
         throw new ServerException($error->getMessage());
     }
 }
コード例 #2
0
ファイル: Connection.php プロジェクト: abframework/ab-redis
 /**
  * Handles -ERR responses returned by Redis.
  *
  * @param CommandInterface       $command Command that generated the -ERR response.
  * @param ErrorResponseInterface $error   Redis error response object.
  *
  * @return mixed
  */
 protected function onErrorResponse($method, $params, $error)
 {
     $details = explode(' ', $error->getMessage(), 2);
     switch ($details[0]) {
         case 'MOVED':
             return $this->onMovedResponse($command, $details[1]);
         default:
             return $error;
     }
 }