Esempio n. 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;
 }
Esempio n. 2
0
 /**
  * Handles -ERR responses returned by Redis.
  *
  * @param CommandInterface $command The command that generated the error.
  * @param ResponseErrorInterface $response The error response instance.
  * @return mixed
  */
 protected function onResponseError(CommandInterface $command, ResponseErrorInterface $response)
 {
     if ($command instanceof ScriptedCommand && $response->getErrorType() === 'NOSCRIPT') {
         $eval = $this->createCommand('eval');
         $eval->setRawArguments($command->getEvalArguments());
         return $this->executeCommand($eval);
     }
     if ($this->options->exceptions === true) {
         throw new ServerException($response->getMessage());
     }
     return $response;
 }