diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-09-26 11:21:39 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-09-26 13:54:51 +0200 |
commit | 11c31e94fe6afaaba7c94a009cc931a5515d77a1 (patch) | |
tree | c5fe873526d1be62a94d207df342a6d5d242552a /index.php | |
parent | ef3e8faea22a3a7278dbf24f3988c80d80415090 (diff) | |
download | nextcloud-server-11c31e94fe6afaaba7c94a009cc931a5515d77a1.tar.gz nextcloud-server-11c31e94fe6afaaba7c94a009cc931a5515d77a1.zip |
Improve exception handling
If there is an exception in the template handling then a white page is shown.
This improves the handling of this and shows text only about the internal
error.
To test this just setup redis as cache and then disable the php-redis module.
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/index.php b/index.php index cd95b0c7965..f45b67811f2 100644 --- a/index.php +++ b/index.php @@ -47,7 +47,16 @@ try { OC_Template::printExceptionErrorPage($ex); } catch (\OC\HintException $ex) { OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); - OC_Template::printErrorPage($ex->getMessage(), $ex->getHint()); + try { + OC_Template::printErrorPage($ex->getMessage(), $ex->getHint()); + } catch (Exception $ex2) { + \OC::$server->getLogger()->logException($ex, array('app' => 'index')); + \OC::$server->getLogger()->logException($ex2, array('app' => 'index')); + + //show the user a detailed error page + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); + OC_Template::printExceptionErrorPage($ex); + } } catch (\OC\User\LoginException $ex) { OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN); OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage()); |