[index] Throw exception if no items received

This adds an exception if no items were returned by the bridge. It
might indicate a broken bridge or invalid input parameter.
This commit is contained in:
logmanoriginal 2017-07-28 22:00:47 +02:00
parent 6e4bc341b7
commit 6f6aaa3aec

View File

@ -168,7 +168,12 @@ try {
// Data transformation
try {
$format = Format::create($format);
$format->setItems($bridge->getItems());
$items = $bridge->getItems();
if(empty($items)){
throw new Exception('No results for this query', 503);
}
$format->setItems($items);
$format->setExtraInfos($bridge->getExtraInfos());
$format->display();
} catch(Exception $e){