|
|
@ -102,7 +102,6 @@ class FrontController |
|
|
|
|
|
|
|
public function execute() |
|
|
|
{ |
|
|
|
try { |
|
|
|
$request = \Majestic\Env::getRequestUri(true); |
|
|
|
$route = $this->getRouter()->route($request); |
|
|
|
if (!$route) { |
|
|
@ -134,30 +133,4 @@ class FrontController |
|
|
|
} |
|
|
|
return $html; |
|
|
|
} |
|
|
|
catch (\Exception $e) { |
|
|
|
if (\Majestic\Config::get('DEBUG')) { |
|
|
|
if (!headers_sent()) { |
|
|
|
if ($e instanceof \Majestic\Exception\ErrorHTTPException) { |
|
|
|
header($e->getHTTPHeader()); |
|
|
|
} else { |
|
|
|
header('HTTP/1.0 500 Internal Server Error'); |
|
|
|
} |
|
|
|
} |
|
|
|
\Majestic\Exception\ErrorHandler::logError($e); |
|
|
|
return \Majestic\Exception\ErrorHandler::showDebug($e); |
|
|
|
} |
|
|
|
$layout_class = $this->getRouter()->getErrorLayout(); |
|
|
|
|
|
|
|
/** |
|
|
|
* @var \Majestic\Layout\ErrorLayout $layout |
|
|
|
*/ |
|
|
|
$layout = new $layout_class(); |
|
|
|
$layout->setException($e); |
|
|
|
$error_action = new ErrorAction($e); |
|
|
|
if (isset($action_class) && is_subclass_of($action_class, 'AjaxAction')) { |
|
|
|
$error_action->setAjaxError(); |
|
|
|
} |
|
|
|
return $layout->fetch($error_action); |
|
|
|
} |
|
|
|
} |
|
|
|
} |