Exemplo n.º 1
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());
         $response = $this->executeCommand($eval);
         if (!$response instanceof ResponseObjectInterface) {
             $response = $command->parseResponse($response);
         }
         return $response;
     }
     if ($this->options->exceptions) {
         throw new ServerException($response->getMessage());
     }
     return $response;
 }