Predis\Client::onErrorResponse PHP Method

onErrorResponse() protected method

Handles -ERR responses returned by Redis.
protected onErrorResponse ( Predis\Command\CommandInterface $command, Predis\Response\ErrorInterface $response ) : mixed
$command Predis\Command\CommandInterface Redis command that generated the error.
$response Predis\Response\ErrorInterface Instance of the error response.
return mixed
    protected function onErrorResponse(CommandInterface $command, ErrorResponseInterface $response)
    {
        if ($command instanceof ScriptCommand && $response->getErrorType() === 'NOSCRIPT') {
            $response = $this->executeCommand($command->getEvalCommand());
            if (!$response instanceof ResponseInterface) {
                $response = $command->parseResponse($response);
            }
            return $response;
        }
        if ($this->options->exceptions) {
            throw new ServerException($response->getMessage());
        }
        return $response;
    }