diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-06-29 11:22:05 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-06-29 11:22:05 +0200 |
commit | 478b95cc20de9173cbda4c7f69ac3a78ca448250 (patch) | |
tree | 6b203c3a7aedc437d132c0a446a69476deff9d5a /lib/private/legacy/template.php | |
parent | eded07f28fade99bdb7d832bf9294cbd609e2802 (diff) | |
download | nextcloud-server-478b95cc20de9173cbda4c7f69ac3a78ca448250.tar.gz nextcloud-server-478b95cc20de9173cbda4c7f69ac3a78ca448250.zip |
Try to not run into the white page of death and still log something in the web server error log
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/legacy/template.php')
-rw-r--r-- | lib/private/legacy/template.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php index f84d6386deb..1505089d561 100644 --- a/lib/private/legacy/template.php +++ b/lib/private/legacy/template.php @@ -358,9 +358,21 @@ class OC_Template extends \OC\Template\Base { $content->assign('requestID', $request->getId()); $content->printPage(); } catch (\Exception $e) { - $logger = \OC::$server->getLogger(); - $logger->logException($exception, ['app' => 'core']); - $logger->logException($e, ['app' => 'core']); + try { + $logger = \OC::$server->getLogger(); + $logger->logException($exception, ['app' => 'core']); + $logger->logException($e, ['app' => 'core']); + } catch (Throwable $e) { + // no way to log it properly - but to avoid a white page of death we send some output + header('Content-Type: text/plain; charset=utf-8'); + print("Internal Server Error\n\n"); + print("The server encountered an internal error and was unable to complete your request.\n"); + print("Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n"); + print("More details can be found in the server log.\n"); + + // and then throw it again to log it at least to the web server error log + throw $e; + } header('Content-Type: text/plain; charset=utf-8'); print("Internal Server Error\n\n"); |