private function GuzzleConnectionDebug::process4xxError in Elasticsearch Connector 7
Same name and namespace in other branches
- 7.5 modules/elasticsearch_connector_devel/includes/GuzzleConnectionDebugging.inc \Elasticsearch\Connections\GuzzleConnectionDebug::process4xxError()
- 7.2 modules/elasticsearch_connector_devel/includes/GuzzleConnectionDebugging.inc \Elasticsearch\Connections\GuzzleConnectionDebug::process4xxError()
1 call to GuzzleConnectionDebug::process4xxError()
- GuzzleConnectionDebug::sendRequest in modules/
elasticsearch_connector_devel/ includes/ GuzzleConnectionDebugging.inc
File
- modules/
elasticsearch_connector_devel/ includes/ GuzzleConnectionDebugging.inc, line 249
Class
Namespace
Elasticsearch\ConnectionsCode
private function process4xxError(Request $request, ClientErrorResponseException $exception, $body) {
$this
->logErrorDueToFailure($request, $exception, $body);
$statusCode = $request
->getResponse()
->getStatusCode();
$exceptionText = $exception
->getMessage();
$responseBody = $request
->getResponse()
->getBody(true);
$exceptionText = "{$statusCode} Server Exception: {$exceptionText}\n{$responseBody}";
if ($statusCode === 400 && strpos($responseBody, "AlreadyExpiredException") !== false) {
throw new AlreadyExpiredException($exceptionText, $statusCode, $exception);
}
elseif ($statusCode === 403) {
throw new Forbidden403Exception($exceptionText, $statusCode, $exception);
}
elseif ($statusCode === 404) {
throw new Missing404Exception($exceptionText, $statusCode, $exception);
}
elseif ($statusCode === 409) {
throw new Conflict409Exception($exceptionText, $statusCode, $exception);
}
elseif ($statusCode === 400 && strpos($responseBody, 'script_lang not supported') !== false) {
throw new ScriptLangNotSupportedException($exceptionText . $statusCode);
}
}