mirror of
https://github.com/predis/predis.git
synced 2026-10-09 21:38:07 +00:00
Deprecate the whole Predis\Helpers class.
This commit is contained in:
@@ -54,4 +54,23 @@ abstract class CommunicationException extends PredisException
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Offers a generic and reusable method to handle exceptions generated by
|
||||
* a connection object.
|
||||
*
|
||||
* @param CommunicationException $exception Exception.
|
||||
*/
|
||||
public static function handle(CommunicationException $exception)
|
||||
{
|
||||
if ($exception->shouldResetConnection()) {
|
||||
$connection = $exception->getConnection();
|
||||
|
||||
if ($connection->isConnected()) {
|
||||
$connection->disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user