aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-09-26 14:44:47 +0200
committerGitHub <noreply@github.com>2017-09-26 14:44:47 +0200
commit3bde76302fb32f70321cccd0f01dddf4729a841f (patch)
treec5fe873526d1be62a94d207df342a6d5d242552a
parentef3e8faea22a3a7278dbf24f3988c80d80415090 (diff)
parent11c31e94fe6afaaba7c94a009cc931a5515d77a1 (diff)
downloadnextcloud-server-3bde76302fb32f70321cccd0f01dddf4729a841f.tar.gz
nextcloud-server-3bde76302fb32f70321cccd0f01dddf4729a841f.zip
Merge pull request #6643 from nextcloud/improved-redis-warning
Improve exception handling
-rw-r--r--index.php11
-rw-r--r--lib/private/Log.php3
2 files changed, 13 insertions, 1 deletions
diff --git a/index.php b/index.php
index cd95b0c7965..f45b67811f2 100644
--- a/index.php
+++ b/index.php
@@ -47,7 +47,16 @@ try {
OC_Template::printExceptionErrorPage($ex);
} catch (\OC\HintException $ex) {
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
- OC_Template::printErrorPage($ex->getMessage(), $ex->getHint());
+ try {
+ OC_Template::printErrorPage($ex->getMessage(), $ex->getHint());
+ } catch (Exception $ex2) {
+ \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
+ \OC::$server->getLogger()->logException($ex2, array('app' => 'index'));
+
+ //show the user a detailed error page
+ OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
+ OC_Template::printExceptionErrorPage($ex);
+ }
} catch (\OC\User\LoginException $ex) {
OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN);
OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage());
diff --git a/lib/private/Log.php b/lib/private/Log.php
index d93b29414e6..39577d2387a 100644
--- a/lib/private/Log.php
+++ b/lib/private/Log.php
@@ -331,6 +331,9 @@ class Log implements ILogger {
'Line' => $exception->getLine(),
);
$data['Trace'] = preg_replace('!(' . implode('|', $this->methodsWithSensitiveParameters) . ')\(.*\)!', '$1(*** sensitive parameters replaced ***)', $data['Trace']);
+ if ($exception instanceof HintException) {
+ $data['Hint'] = $exception->getHint();
+ }
$msg = isset($context['message']) ? $context['message'] : 'Exception';
$msg .= ': ' . json_encode($data);
$this->log($level, $msg, $context);