Browse Source

Apply fixes on error responses from sentinel.

Fixes manually picked from @djagya's fork, thanks for spotting!
Daniele Alessandri 9 years ago
parent
commit
622e6c6ba2
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/Connection/Aggregate/SentinelReplication.php

+ 5 - 1
src/Connection/Aggregate/SentinelReplication.php

@@ -211,6 +211,10 @@ class SentinelReplication extends MasterSlaveReplication
             throw new ServerException('ERR No such master with that name');
         }
 
+        if ($payload instanceof ErrorResponseInterface) {
+            throw new ServerException($payload->getMessage());
+        }
+
         return array(
             'host' => $payload[0],
             'port' => $payload[1],
@@ -235,7 +239,7 @@ class SentinelReplication extends MasterSlaveReplication
         );
 
         if ($payload instanceof ErrorResponseInterface) {
-            throw new ServerException($response->getMessage());
+            throw new ServerException($payload->getMessage());
         }
 
         foreach ($payload as $slave) {