Пример #1
0
<?php

try {
    require_once '../config/core.conf.php';
    header('Content-type: text/html; charset=' . Lang::$encoding);
    //$profiler = new Profiler();
    $controller = new ActionController();
    $controller->handle();
    //$profiler->stop();
    //echo $profiler->getSummary();
} catch (Exception $e) {
    $response = new Response();
    $vars = array('title' => 'Erreur', 'description' => 'Erreur');
    //
    $class_exception = get_class($e);
    $msg_exception = $class_exception . ' : ' . $e->getMessage();
    Logger::log($msg_exception);
    if (CORE_DEBUG) {
        echo '<pre>' . $msg_exception . '</pre>';
        exit;
        //
    }
    //
    if ($e instanceof AutoloadException || $e instanceof ActionControllerException) {
        $response->redirect(ROOT_HTTP . 'error/404');
    }
    if ($e instanceof Exception || $e instanceof ViewException) {
        $response->redirect(ROOT_HTTP . 'error/500');
    }
}