git.cweiske.de
/
phorkie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1a8bb56
)
throw exception when search throws exception
author
Christian Weiske
<cweiske@cweiske.de>
Tue, 1 May 2012 19:29:48 +0000
(21:29 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Tue, 1 May 2012 19:29:48 +0000
(21:29 +0200)
src/phorkie/Search/Elasticsearch.php
patch
|
blob
|
history
diff --git
a/src/phorkie/Search/Elasticsearch.php
b/src/phorkie/Search/Elasticsearch.php
index d03ef3ecb317b3f280684b54d939d8b34be95e86..3c3ea8351f2397f373f6bd5951a9272b19f1b2d7 100644
(file)
--- a/
src/phorkie/Search/Elasticsearch.php
+++ b/
src/phorkie/Search/Elasticsearch.php
@@
-53,9
+53,13
@@
class Search_Elasticsearch
)
)
);
)
)
);
- //FIXME: error handling
$httpRes = $r->send();
$jRes = json_decode($httpRes->getBody());
$httpRes = $r->send();
$jRes = json_decode($httpRes->getBody());
+ if (isset($jRes->error)) {
+ throw new Exception(
+ 'Search exception: ' . $jRes->error, $jRes->status
+ );
+ }
$sres = new Search_Result();
$sres->results = $jRes->hits->total;
$sres = new Search_Result();
$sres->results = $jRes->hits->total;