[index] Clarify error message during data transformation

An empty list of items should not throw an exception as this is
technically still a valid feed (just empty). Instead the error
message should focus on actual transformation errors.
This commit is contained in:
logmanoriginal 2017-07-28 22:45:52 +02:00
parent 431e35e07f
commit 27fad6d2af

View File

@ -197,12 +197,7 @@ EOD;
// Data transformation // Data transformation
try { try {
$format = Format::create($format); $format = Format::create($format);
$items = $bridge->getItems(); $format->setItems($bridge->getItems());
if(empty($items)){
throw new Exception('No results for this query', 503);
}
$format->setItems($items);
$format->setExtraInfos($bridge->getExtraInfos()); $format->setExtraInfos($bridge->getExtraInfos());
$format->display(); $format->display();
} catch(Exception $e){ } catch(Exception $e){
@ -217,7 +212,7 @@ EOD;
. $bridge->getMaintainer(); . $bridge->getMaintainer();
$message = <<<EOD $message = <<<EOD
{$bridge->getName()} was unable to receive or process the remote website's content. RSS-Bridge was unable to transform the contents returned by {$bridge->getName()}!
Check your input parameters or press F5 to retry. Check your input parameters or press F5 to retry.
Use the following link to notify the bridge maintainer if this error persists: Use the following link to notify the bridge maintainer if this error persists:
@ -233,6 +228,7 @@ EOD;
header('Content-Type: text/plain'); header('Content-Type: text/plain');
die($message); die($message);
} }
die; die;
} }
} }