You are here

private function GuzzleConnectionDebug::sendRequest in Elasticsearch Connector 7

Same name and namespace in other branches
  1. 7.5 modules/elasticsearch_connector_devel/includes/GuzzleConnectionDebugging.inc \Elasticsearch\Connections\GuzzleConnectionDebug::sendRequest()
  2. 7.2 modules/elasticsearch_connector_devel/includes/GuzzleConnectionDebugging.inc \Elasticsearch\Connections\GuzzleConnectionDebug::sendRequest()

Parameters

Request $request:

string $body:

Return value

\Guzzle\Http\Message\Response

Throws

\Elasticsearch\Common\Exceptions\TransportException

1 call to GuzzleConnectionDebug::sendRequest()
GuzzleConnectionDebug::performRequest in modules/elasticsearch_connector_devel/includes/GuzzleConnectionDebugging.inc
Perform an HTTP request on the cluster

File

modules/elasticsearch_connector_devel/includes/GuzzleConnectionDebugging.inc, line 190

Class

GuzzleConnectionDebug

Namespace

Elasticsearch\Connections

Code

private function sendRequest(Request $request, $body) {
  try {
    $request
      ->send();
  } catch (ServerErrorResponseException $exception) {
    $this
      ->process5xxError($request, $exception, $body);
  } catch (ClientErrorResponseException $exception) {
    $this
      ->process4xxError($request, $exception, $body);
  } catch (CurlException $exception) {
    $this
      ->processCurlError($exception);
  } catch (\Exception $exception) {
    $error = 'Unexpected error: ' . $exception
      ->getMessage();
    $this->log
      ->critical($error);
    throw new TransportException($error);
  }
  $this
    ->processSuccessfulRequest($request, $body);
  return $request
    ->getResponse();
}