[index] Always write exceptions to error.log
Exceptions are reported to users, but they do not necessarily appear in the error log on the server. Using 'error_log' we can explicitly write exceptions and error messages to the log file, using the standard PHP message format. For more information see https://stackoverflow.com/a/26867035
This commit is contained in:
parent
b4b5340b7e
commit
89ca42da54
1 changed files with 8 additions and 0 deletions
|
@ -262,6 +262,8 @@ try {
|
|||
'icon' => $bridge->getIcon()
|
||||
);
|
||||
} catch(Error $e) {
|
||||
error_log($e);
|
||||
|
||||
$item = array();
|
||||
|
||||
// Create "new" error message every 24 hours
|
||||
|
@ -280,6 +282,8 @@ try {
|
|||
|
||||
$items[] = $item;
|
||||
} catch(Exception $e) {
|
||||
error_log($e);
|
||||
|
||||
$item = array();
|
||||
|
||||
// Create "new" error message every 24 hours
|
||||
|
@ -309,10 +313,12 @@ try {
|
|||
$format->setLastModified($cache->getTime());
|
||||
$format->display();
|
||||
} catch(Error $e) {
|
||||
error_log($e);
|
||||
http_response_code($e->getCode());
|
||||
header('Content-Type: text/html');
|
||||
die(buildTransformException($e, $bridge));
|
||||
} catch(Exception $e) {
|
||||
error_log($e);
|
||||
http_response_code($e->getCode());
|
||||
header('Content-Type: text/html');
|
||||
die(buildTransformException($e, $bridge));
|
||||
|
@ -321,9 +327,11 @@ try {
|
|||
echo BridgeList::create($whitelist_selection, $showInactive);
|
||||
}
|
||||
} catch(HttpException $e) {
|
||||
error_log($e);
|
||||
http_response_code($e->getCode());
|
||||
header('Content-Type: text/plain');
|
||||
die($e->getMessage());
|
||||
} catch(\Exception $e) {
|
||||
error_log($e);
|
||||
die($e->getMessage());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue