Skip to content

Commit

Permalink
catch exception on HEAD 404 request
Browse files Browse the repository at this point in the history
  • Loading branch information
dittertp committed Oct 17, 2014
1 parent a30a5a0 commit 4ccdb95
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/EsClient/Namespaces/IndicesNamespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,19 @@ public function exists($params)

try {
$response = $endpoint->performRequest();
} catch (Missing404Exception $exception) {
return false;
}


if ($response['status'] === 200) {
return true;
} else {
return false;
if ($response['status'] === 200) {
return true;
} else {
return false;
}

} catch (\Exception $exception) {
if ($exception->getCode() == 404) {
return false;
} else {
throw new $exception;
}
}
}

Expand Down

0 comments on commit 4ccdb95

Please sign in to comment.