Catch unhandled exceptions in index.php
Summary: When there is an exception in `index.php` then we currently get only blank screen. Print it instead. Test Plan: Thrown exceptions on several places of `index.php` and controller, got best results. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3619
This commit is contained in:
@@ -109,10 +109,6 @@ try {
|
|||||||
|
|
||||||
PhutilErrorHandler::initialize();
|
PhutilErrorHandler::initialize();
|
||||||
|
|
||||||
} catch (Exception $ex) {
|
|
||||||
phabricator_fatal("[Initialization Exception] ".$ex->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
PhutilErrorHandler::setErrorListener(
|
PhutilErrorHandler::setErrorListener(
|
||||||
array('DarkConsoleErrorLogPluginAPI', 'handleErrors'));
|
array('DarkConsoleErrorLogPluginAPI', 'handleErrors'));
|
||||||
|
|
||||||
@@ -259,6 +255,11 @@ if (DarkConsoleXHProfPluginAPI::isProfilerRequested()) {
|
|||||||
$profile_sample->save();
|
$profile_sample->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
phabricator_fatal("[Exception] ".$ex->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group aphront
|
* @group aphront
|
||||||
*/
|
*/
|
||||||
@@ -352,11 +353,15 @@ function phabricator_fatal($msg) {
|
|||||||
|
|
||||||
global $access_log;
|
global $access_log;
|
||||||
if ($access_log) {
|
if ($access_log) {
|
||||||
|
try {
|
||||||
$access_log->setData(
|
$access_log->setData(
|
||||||
array(
|
array(
|
||||||
'c' => 500,
|
'c' => 500,
|
||||||
));
|
));
|
||||||
$access_log->write();
|
$access_log->write();
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
$msg .= "\nMoreover unable to write to access log.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header(
|
header(
|
||||||
|
|||||||
Reference in New Issue
Block a user