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:
-rw-r--r--console.php2
-rw-r--r--cron.php2
-rw-r--r--index.php8
-rw-r--r--lib/private/template.php2
-rw-r--r--public.php16
-rw-r--r--remote.php8
6 files changed, 26 insertions, 12 deletions
diff --git a/console.php b/console.php
index 9d2271db9f2..559c1778f1d 100644
--- a/console.php
+++ b/console.php
@@ -95,4 +95,6 @@ try {
$application->run();
} catch (Exception $ex) {
exceptionHandler($ex);
+} catch (Error $ex) {
+ exceptionHandler($ex);
}
diff --git a/cron.php b/cron.php
index 73f233e1350..f0dde4fea7f 100644
--- a/cron.php
+++ b/cron.php
@@ -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);
}
diff --git a/index.php b/index.php
index f3bf699f3c1..2acf81ab6d7 100644
--- a/index.php
+++ b/index.php
@@ -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);
}
diff --git a/lib/private/template.php b/lib/private/template.php
index c6542356fac..73725529702 100644
--- a/lib/private/template.php
+++ b/lib/private/template.php
@@ -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 {
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);
}
diff --git a/remote.php b/remote.php
index 814286860af..991ca0d2302 100644
--- a/remote.php
+++ b/remote.php
@@ -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);
}