handle service not available exceptions in index, remote and public.php

This commit is contained in:
Robin Appelman 2014-07-24 17:18:10 +02:00
parent 4608f8a3b5
commit a05147e25c
3 changed files with 15 additions and 0 deletions

View File

@ -27,6 +27,12 @@ try {
OC::handleRequest();
} catch(\OC\ServiceUnavailableException $ex) {
\OCP\Util::logException('index', $ex);
//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
OC_Template::printExceptionErrorPage($ex);
} catch (Exception $ex) {
\OCP\Util::logException('index', $ex);

View File

@ -45,6 +45,11 @@ try {
require_once OC_App::getAppPath($app) . '/' . $parts[1];
} catch (\OC\ServiceUnavailableException $ex) {
//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_Template::printExceptionErrorPage($ex);
} catch (Exception $ex) {
//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);

View File

@ -51,6 +51,10 @@ try {
$baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/';
require_once $file;
} catch (\OC\ServiceUnavailableException $ex) {
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
\OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
OC_Template::printExceptionErrorPage($ex);
} catch (Exception $ex) {
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
\OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);