From 21a5547f96c5b39ddbc6584c704cbf7cdbbf9af4 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Fri, 28 Jul 2017 22:03:11 +0200 Subject: [PATCH] [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). --- index.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 7667b701..9b3eed63 100644 --- a/index.php +++ b/index.php @@ -177,7 +177,32 @@ try { $format->setExtraInfos($bridge->getExtraInfos()); $format->display(); } 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 = <<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; }