modified FrontController to get error layout from Router

This commit is contained in:
Anton Grebnev
2012-06-04 16:09:16 +04:00
parent 90a8cb30e6
commit 1d999bda3f
2 changed files with 15 additions and 9 deletions

View File

@ -41,8 +41,10 @@ class FrontController
/**
* Refuse cloning
*/
private function __clone(){}
private function __clone()
{
}
/**
* @return FrontController
*/
@ -126,14 +128,20 @@ class FrontController
}
}
return $html;
} catch(Exception $e) {
} catch (Exception $e) {
if (DEBUG == true) {
if (!headers_sent()) {
header('HTTP/1.0 500 Internal Server Error');
}
return ErrorHandler::showDebug($e);
}
$layout = new ErrorLayout();
$layout_class = $this->getRouter()->getErrorLayout();
/**
* @var ErrorLayout $layout
*/
$layout = new $layout_class();
$layout->setException($e);
return $layout->fetch(new ErrorAction($e));
}
}