[index] Improve error handling (#555)

Add additional information to error message:

- Name of the bridge
- Possible solutions
- Error description
- Error code
- Error message

* Output type changed from 'text' to 'html'
* Added styles for the error page
* Added a button to remotely open a GitHub issue

Closes #525
This commit is contained in:
LogMANOriginal 2017-07-29 19:16:16 +02:00 committed by GitHub
parent 6e4bc341b7
commit 38b56bf23a
3 changed files with 195 additions and 3 deletions

View file

@ -162,8 +162,14 @@ try {
unset($params['_noproxy']);
// Load cache & data
$bridge->setCache($cache);
$bridge->setDatas($params);
try {
$bridge->setCache($cache);
$bridge->setDatas($params);
} catch(Exception $e){
header('HTTP/1.1 ' . $e->getCode() . ' ' . Http::getMessageForCode($e->getCode()));
header('Content-Type: text/html');
die(buildBridgeException($e, $bridge));
}
// Data transformation
try {
@ -172,8 +178,11 @@ try {
$format->setExtraInfos($bridge->getExtraInfos());
$format->display();
} catch(Exception $e){
echo "The bridge has crashed. You should report this to the bridges maintainer";
header('HTTP/1.1 ' . $e->getCode() . ' ' . Http::getMessageForCode($e->getCode()));
header('Content-Type: text/html');
die(buildTransformException($e, $bridge));
}
die;
}
}