Error reporting. See #142

This commit is contained in:
Dan Cryer 2013-10-08 08:23:07 +01:00
parent deb71ec9e2
commit df1dc0d666

View file

@ -24,6 +24,7 @@ class Application extends b8\Application
*/ */
public function handleRequest() public function handleRequest()
{ {
try {
$this->initRequest(); $this->initRequest();
// Validate the user's session unless it is a login/logout action or a web hook: // Validate the user's session unless it is a login/logout action or a web hook:
@ -34,6 +35,33 @@ class Application extends b8\Application
if($skipValidation || $this->validateSession()) { if($skipValidation || $this->validateSession()) {
parent::handleRequest(); parent::handleRequest();
} }
} catch (\Exception $ex) {
$content = '<h1>There was a problem with this request</h1><p>Please paste the details below into a <a href="https://github.com/Block8/PHPCI/issues/new">new bug report</a> so that we can investigate and fix it.</p>';
ob_start();
var_dump(array(
'message' => $ex->getMessage(),
'file' => $ex->getFile(),
'line' => $ex->getLine(),
'trace' => $ex->getTraceAsString()
));
var_dump(array(
'PATH_INFO' => $_SERVER['PATH_INFO'],
'REDIRECT_PATH_INFO' => $_SERVER['REDIRECT_PATH_INFO'],
'REQUEST_URI' => $_SERVER['REQUEST_URI'],
'PHP_SELF' => $_SERVER['PHP_SELF'],
'SCRIPT_NAME' => $_SERVER['SCRIPT_NAME'],
'DOCUMENT_ROOT' => $_SERVER['DOCUMENT_ROOT'],
'SCRIPT_FILENAME' => $_SERVER['SCRIPT_FILENAME'],
'SERVER_SOFTWARE' => $_SERVER['SERVER_SOFTWARE'],
));
$content .= ob_get_contents();
ob_end_clean();
$this->response->setContent($content);
$this->response->disableLayout();
}
if (View::exists('layout') && $this->response->hasLayout()) { if (View::exists('layout') && $this->response->hasLayout()) {
$view = new View('layout'); $view = new View('layout');