Skip to content

Commit

Permalink
Add catch-all in exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
polyfractal committed Nov 2, 2016
1 parent fd38538 commit eb4117c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Elasticsearch/Connections/Connection.php
Expand Up @@ -594,6 +594,8 @@ private function process4xxError($request, $response, $ignore)
$exception = new ScriptLangNotSupportedException($responseBody. $statusCode);
} elseif ($statusCode === 408) {
$exception = new RequestTimeout408Exception($responseBody, $statusCode);
} else {
$exception = new BadRequest400Exception($responseBody, $statusCode);
}

$this->logRequestFail(
Expand Down Expand Up @@ -638,6 +640,8 @@ private function process5xxError($request, $response, $ignore)
$exception = new NoDocumentsToGetException($exception->getMessage(), $statusCode, $exception);
} elseif ($statusCode === 500 && strpos($responseBody, 'NoShardAvailableActionException') !== false) {
$exception = new NoShardAvailableException($exception->getMessage(), $statusCode, $exception);
} else {
$exception = new ServerErrorResponseException($responseBody, $statusCode);
}

$this->logRequestFail(
Expand Down

0 comments on commit eb4117c

Please sign in to comment.