Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-04-20 19:01:47 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2016-04-20 19:01:47 +0300
commit6a6fc742dc736875a9d0a2be6891ba0fc635f1dc (patch)
tree2f559b670be9f312e14e58de8879189ecccef01f /public.php
parent069af51dd039fe9790b420b0e74289309a4952c4 (diff)
Catch class Error on all root entrypoints
Diffstat (limited to 'public.php')
-rw-r--r--public.php16
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);
}