@@ -95,4 +95,6 @@ try { | |||
$application->run(); | |||
} catch (Exception $ex) { | |||
exceptionHandler($ex); | |||
} catch (Error $ex) { | |||
exceptionHandler($ex); | |||
} |
@@ -175,4 +175,6 @@ try { | |||
} catch (Exception $ex) { | |||
\OCP\Util::writeLog('cron', $ex->getMessage(), \OCP\Util::FATAL); | |||
} catch (Error $ex) { | |||
\OCP\Util::writeLog('cron', $ex->getMessage(), \OCP\Util::FATAL); | |||
} |
@@ -39,7 +39,7 @@ try { | |||
OC::handleRequest(); | |||
} catch(\OC\ServiceUnavailableException $ex) { | |||
\OCP\Util::logException('index', $ex); | |||
\OC::$server->getLogger()->logException($ex, ['app' => 'index']); | |||
//show the user a detailed error page | |||
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); | |||
@@ -48,9 +48,13 @@ try { | |||
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); | |||
OC_Template::printErrorPage($ex->getMessage(), $ex->getHint()); | |||
} catch (Exception $ex) { | |||
\OCP\Util::logException('index', $ex); | |||
\OC::$server->getLogger()->logException($ex, ['app' => 'index']); | |||
//show the user a detailed error page | |||
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); | |||
OC_Template::printExceptionErrorPage($ex); | |||
} catch (Error $ex) { | |||
\OC::$server->getLogger()->logException($ex, ['app' => 'index']); | |||
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); | |||
OC_Template::printExceptionErrorPage($ex); | |||
} |
@@ -333,7 +333,7 @@ class OC_Template extends \OC\Template\Base { | |||
/** | |||
* print error page using Exception details | |||
* @param Exception $exception | |||
* @param Exception | Throwable $exception | |||
*/ | |||
public static function printExceptionErrorPage($exception, $fetchPage = false) { | |||
try { |
@@ -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); | |||
} |
@@ -40,9 +40,9 @@ class RemoteException extends Exception { | |||
} | |||
/** | |||
* @param Exception $e | |||
* @param Exception | Error $e | |||
*/ | |||
function handleException(Exception $e) { | |||
function handleException($e) { | |||
$request = \OC::$server->getRequest(); | |||
// in case the request content type is text/xml - we assume it's a WebDAV request | |||
$isXmlContentType = strpos($request->getHeader('Content-Type'), 'text/xml'); | |||
@@ -77,7 +77,7 @@ function handleException(Exception $e) { | |||
OC_Response::setStatus($e->getCode()); | |||
OC_Template::printErrorPage($e->getMessage()); | |||
} else { | |||
\OCP\Util::writeLog('remote', $e->getMessage(), \OCP\Util::FATAL); | |||
\OC::$server->getLogger()->logException($e, ['app' => 'remote']); | |||
OC_Response::setStatus($statusCode); | |||
OC_Template::printExceptionErrorPage($e); | |||
} | |||
@@ -165,4 +165,6 @@ try { | |||
} catch (Exception $ex) { | |||
handleException($ex); | |||
} catch (Error $e) { | |||
handleException($ex); | |||
} |