getErrorType() 공개 메소드

Returns the error type (e.g. ERR, ASK, MOVED).
public getErrorType ( ) : string
리턴 string
예제 #1
0
 /**
  * Handles -ERR responses returned by Redis.
  *
  * @param CommandInterface       $command  Redis command that generated the error.
  * @param ErrorResponseInterface $response Instance of the error response.
  *
  * @throws ServerException
  *
  * @return mixed
  */
 protected function onErrorResponse(CommandInterface $command, ErrorResponseInterface $response)
 {
     if ($command instanceof ScriptCommand && $response->getErrorType() === 'NOSCRIPT') {
         $eval = $this->createCommand('EVAL');
         $eval->setRawArguments($command->getEvalArguments());
         $response = $this->executeCommand($eval);
         if (!$response instanceof ResponseInterface) {
             $response = $command->parseResponse($response);
         }
         return $response;
     }
     if ($this->options->exceptions) {
         throw new ServerException($response->getMessage());
     }
     return $response;
 }
예제 #2
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());
     }
 }