Change how Redis errors such as -ERR replies generates exceptions.

The "throw_errors" connection parameter has been removed and replaced by the
new "exceptions" client option since exceptions on -ERR replies returned by
Redis are not generated by connection classes anymore but are thrown by the
client class and other abstractions such as pipeline contexts.

This change does not affect much people using the Predis\Client class (aside
from the different configuration) but gives much more flexibility to those
building their own pieces of code around the internal classes of Predis.
This commit is contained in:
Daniele Alessandri
2012-04-27 17:03:32 +02:00
parent 90f37f8698
commit 41c29bed4e
27 changed files with 320 additions and 160 deletions
+2 -11
View File
@@ -44,7 +44,6 @@ class TextProtocol implements ProtocolInterface
const BUFFER_SIZE = 4096;
private $mbiterable;
private $throwErrors;
private $serializer;
/**
@@ -52,9 +51,8 @@ class TextProtocol implements ProtocolInterface
*/
public function __construct()
{
$this->mbiterable = false;
$this->throwErrors = true;
$this->serializer = new TextCommandSerializer();
$this->mbiterable = false;
$this->serializer = new TextCommandSerializer();
}
/**
@@ -115,9 +113,6 @@ class TextProtocol implements ProtocolInterface
return (int) $payload;
case '-': // error
if ($this->throwErrors) {
throw new ServerException($payload);
}
return new ResponseError($payload);
default:
@@ -136,10 +131,6 @@ class TextProtocol implements ProtocolInterface
case 'iterable_multibulk':
$this->mbiterable = (bool) $value;
break;
case 'throw_errors':
$this->throwErrors = (bool) $value;
break;
}
}
}