mirror of
https://github.com/predis/predis.git
synced 2026-10-16 00:36:45 +00:00
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:
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace Predis\Protocol\Text;
|
||||
|
||||
use Predis\ServerException;
|
||||
use Predis\ResponseError;
|
||||
use Predis\Protocol\ResponseHandlerInterface;
|
||||
use Predis\Connection\ComposableConnectionInterface;
|
||||
|
||||
@@ -19,19 +19,19 @@ use Predis\Connection\ComposableConnectionInterface;
|
||||
* Implements a response handler for error replies using the standard wire
|
||||
* protocol defined by Redis.
|
||||
*
|
||||
* This handler throws an exception to notify the user that an error has
|
||||
* This handler returns a reply object to notify the user that an error has
|
||||
* occurred on the server.
|
||||
*
|
||||
* @link http://redis.io/topics/protocol
|
||||
* @author Daniele Alessandri <suppakilla@gmail.com>
|
||||
*/
|
||||
class ResponseErrorHandler implements ResponseHandlerInterface
|
||||
class ResponseErrorSilentHandler implements ResponseHandlerInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handle(ComposableConnectionInterface $connection, $errorMessage)
|
||||
{
|
||||
throw new ServerException($errorMessage);
|
||||
return new ResponseError($errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user