diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-20 18:01:47 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-20 18:01:47 +0200 |
commit | 6a6fc742dc736875a9d0a2be6891ba0fc635f1dc (patch) | |
tree | 2f559b670be9f312e14e58de8879189ecccef01f /public.php | |
parent | 069af51dd039fe9790b420b0e74289309a4952c4 (diff) | |
download | nextcloud-server-6a6fc742dc736875a9d0a2be6891ba0fc635f1dc.tar.gz nextcloud-server-6a6fc742dc736875a9d0a2be6891ba0fc635f1dc.zip |
Catch class Error on all root entrypoints
Diffstat (limited to 'public.php')
-rw-r--r-- | public.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/public.php b/public.php index 65257f1a46e..c4d96c06496 100644 --- a/public.php +++ b/public.php @@ -49,7 +49,7 @@ try { $pathInfo = trim($pathInfo, '/'); list($service) = explode('/', $pathInfo); } - $file = OCP\CONFIG::getAppValue('core', 'public_' . strip_tags($service)); + $file = OCP\Config::getAppValue('core', 'public_' . strip_tags($service)); if (is_null($file)) { header('HTTP/1.0 404 Not Found'); exit; @@ -73,14 +73,18 @@ try { require_once OC_App::getAppPath($app) . '/' . $parts[1]; -} catch (\OC\ServiceUnavailableException $ex) { +} catch (Exception $ex) { + if ($ex instanceof \OC\ServiceUnavailableException) { + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); + } else { + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); + } //show the user a detailed error page - OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); - \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL); + \OC::$server->getLogger()->logException($ex, ['app' => 'public']); OC_Template::printExceptionErrorPage($ex); -} catch (Exception $ex) { +} catch (Error $ex) { //show the user a detailed error page OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); - \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL); + \OC::$server->getLogger()->logException($ex, ['app' => 'public']); OC_Template::printExceptionErrorPage($ex); } |