Browse Source

Remove error handler from FrontController

namespace
Alexander Demidov 11 years ago
parent
commit
8c57655124
  1. 27
      App/FrontController.php
  2. 2
      Exception/ErrorHandler.php

27
App/FrontController.php

@ -102,7 +102,6 @@ class FrontController
public function execute() public function execute()
{ {
try {
$request = \Majestic\Env::getRequestUri(true); $request = \Majestic\Env::getRequestUri(true);
$route = $this->getRouter()->route($request); $route = $this->getRouter()->route($request);
if (!$route) { if (!$route) {
@ -134,30 +133,4 @@ class FrontController
} }
return $html; 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);
}
}
} }

2
Exception/ErrorHandler.php

@ -12,7 +12,7 @@ class ErrorHandler
static public function init() static public function init()
{ {
set_error_handler(array('Majestic\Exception\ErrorHandler', 'error_handler'));
//set_error_handler(array('Majestic\Exception\ErrorHandler', 'error_handler'));
} }
static public function error_handler($errno, $errstr, $errfile, $errline) static public function error_handler($errno, $errstr, $errfile, $errline)

Loading…
Cancel
Save