Skip to content

Commit

Permalink
Remove exception catched in Type::getDocument() ruflin#687
Browse files Browse the repository at this point in the history
  • Loading branch information
rmruano committed Oct 15, 2014
1 parent 4b1c57a commit 27bc16d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
CHANGES

2014-10-15
- Remove exception catched in Type::getDocument() #687

2014-10-10
- Fixed Response::isOk() to work better with bulk update api

Expand Down
9 changes: 3 additions & 6 deletions lib/Elastica/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,15 @@ public function addObjects(array $objects)
* @param string $id Document id
* @param array $options Options for the get request.
* @throws \Elastica\Exception\NotFoundException
* @throws \Elastica\Exception\ResponseException
* @return \Elastica\Document
*/
public function getDocument($id, $options = array())
{
$path = urlencode($id);

try {
$response = $this->request($path, Request::GET, array(), $options);
$result = $response->getData();
} catch (ResponseException $e) {
throw new NotFoundException('unable to retrieve doc id ' . $id. ': '.$e->getMessage(), $e->getCode(), $e);
}
$response = $this->request($path, Request::GET, array(), $options);
$result = $response->getData();

$info = $response->getTransferInfo();
if ($info['http_code'] !== 200) {
Expand Down

0 comments on commit 27bc16d

Please sign in to comment.