Explorar el Código

Fix a few exceptions.

Daniele Alessandri hace 11 años
padre
commit
131a5a4ef9

+ 2 - 1
lib/Predis/Connection/Factory.php

@@ -12,6 +12,7 @@
 namespace Predis\Connection;
 
 use InvalidArgumentException;
+use UnexpectedValueException;
 use ReflectionClass;
 use Predis\Command\RawCommand;
 
@@ -94,7 +95,7 @@ class Factory implements FactoryInterface
         }
 
         if (!$connection instanceof SingleConnectionInterface) {
-            throw new InvalidArgumentException(
+            throw new UnexpectedValueException(
                 "Objects returned by connection initializers must implement ".
                 "'Predis\Connection\SingleConnectionInterface'."
             );

+ 2 - 2
lib/Predis/Response/Iterator/MultiBulkTuple.php

@@ -12,7 +12,7 @@
 namespace Predis\Response\Iterator;
 
 use OuterIterator;
-use RuntimeException;
+use InvalidArgumentException;
 use UnexpectedValueException;
 
 /**
@@ -49,7 +49,7 @@ class MultiBulkTuple extends MultiBulk implements OuterIterator
     protected function checkPreconditions(MultiBulk $iterator)
     {
         if ($iterator->getPosition() !== 0) {
-            throw new RuntimeException(
+            throw new InvalidArgumentException(
                 'Cannot initialize a tuple iterator using an already initiated iterator.'
             );
         }

+ 1 - 1
lib/Predis/Transaction/MultiExec.php

@@ -318,7 +318,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
         } elseif ($this->attempts) {
             $this->discard();
 
-            throw new InvalidArgumentException(
+            throw new ClientException(
                 'Automatic retries are supported only when a callable block is provided.'
             );
         }

+ 1 - 1
tests/Predis/Response/Iterator/MultiBulkTupleTest.php

@@ -23,7 +23,7 @@ class MultiBulkTupleTest extends PredisTestCase
 {
     /**
      * @group disconnected
-     * @expectedException RuntimeException
+     * @expectedException InvalidArgumentException
      * @expectedExceptionMessage Cannot initialize a tuple iterator using an already initiated iterator.
      */
     public function testInitiatedMultiBulkIteratorsAreNotValid()

+ 1 - 1
tests/Predis/Transaction/MultiExecTest.php

@@ -368,7 +368,7 @@ class MultiExecTest extends PredisTestCase
 
     /**
      * @group disconnected
-     * @expectedException InvalidArgumentException
+     * @expectedException Predis\ClientException
      * @expectedExceptionMessage Automatic retries are supported only when a callable block is provided.
      */
     public function testThrowsExceptionOnAutomaticRetriesWithFluentInterface()