Fix a few exceptions.

This commit is contained in:
Daniele Alessandri
2013-12-21 11:08:29 +01:00
parent d1ec791ae9
commit 131a5a4ef9
5 changed files with 7 additions and 6 deletions
+2 -1
View File
@@ -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'."
);
@@ -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
View File
@@ -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.'
);
}
@@ -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
View File
@@ -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()