getConnection() public method

Gets the connection that generated the exception.
public getConnection ( ) : Predis\Connection\NodeConnectionInterface
return Predis\Connection\NodeConnectionInterface
 /**
  * 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;
 }