浏览代码

Pass also the command that generated the server error.

Daniele Alessandri 13 年之前
父节点
当前提交
c36e6fd900
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      lib/Predis/Client.php

+ 4 - 3
lib/Predis/Client.php

@@ -209,7 +209,7 @@ class Client implements ClientInterface
         $response = $this->connection->executeCommand($command);
         $response = $this->connection->executeCommand($command);
 
 
         if ($response instanceof ResponseErrorInterface) {
         if ($response instanceof ResponseErrorInterface) {
-            $this->onResponseError($response);
+            $this->onResponseError($command, $response);
         }
         }
 
 
         return $response;
         return $response;
@@ -231,7 +231,7 @@ class Client implements ClientInterface
         $response = $this->connection->executeCommand($command);
         $response = $this->connection->executeCommand($command);
 
 
         if ($response instanceof ResponseErrorInterface) {
         if ($response instanceof ResponseErrorInterface) {
-            $this->onResponseError($response);
+            $this->onResponseError($command, $response);
         }
         }
 
 
         return $response;
         return $response;
@@ -240,9 +240,10 @@ class Client implements ClientInterface
     /**
     /**
      * Handles -ERR responses returned by Redis.
      * Handles -ERR responses returned by Redis.
      *
      *
+     * @param CommandInterface $command The command that generated the error.
      * @param ResponseErrorInterface $response The error response instance.
      * @param ResponseErrorInterface $response The error response instance.
      */
      */
-    protected function onResponseError(ResponseErrorInterface $response)
+    protected function onResponseError(CommandInterface $command, ResponseErrorInterface $response)
     {
     {
         if ($this->options->exceptions === true) {
         if ($this->options->exceptions === true) {
             $message = $response->getMessage();
             $message = $response->getMessage();