[index] Improve error message for data transformation

Replace error message and add additional information:
- Name of the bridge
- Possible solutions
- Error description
- Error code
- Error message

The error description also includes an URI to create a new issue
on GitHub based on the given error information (prepared).
This commit is contained in:
logmanoriginal 2017-07-28 22:03:11 +02:00
parent 6f6aaa3aec
commit 21a5547f96

View File

@ -177,7 +177,32 @@ try {
$format->setExtraInfos($bridge->getExtraInfos()); $format->setExtraInfos($bridge->getExtraInfos());
$format->display(); $format->display();
} catch(Exception $e){ } catch(Exception $e){
echo "The bridge has crashed. You should report this to the bridges maintainer"; $title = urlencode($bridge->getName() . ' failed with error ' . $e->getCode());
$body = urlencode('Error message: ' . $e->getmessage());
$link = 'https://github.com/rss-bridge/rss-bridge/issues/new?title='
. $title
. '&body='
. $body
. '&labels=bug+report'
. '&assignee='
. $bridge->getMaintainer();
$message = <<<EOD
{$bridge->getName()} was unable to receive or process the remote website's content.
Check your input parameters or press F5 to retry.
Use the following link to notify the bridge maintainer if this error persists:
$link
Additional info:
Error code: "{$e->getCode()}"
Message: "{$e->getMessage()}"
EOD;
header('HTTP/1.1 ' . $e->getCode() . ' ' . Http::getMessageForCode($e->getCode()));
header('Content-Type: text/plain');
die($message);
} }
die; die;
} }