public function renderError($params = null, $code = 404, $exception = null)
    {
        $mode_data = CarteBlanche::getKernelMode(true);
        if (!is_array($mode_data)
            || !isset($mode_data['debug'])
            || false==$mode_data['debug']
        ) {
            $action = 'error'.$code.'Action';
            $_ctrl = CarteBlanche::getContainer()
                ->get('locator')->locateController('Error');
            if (!empty($_ctrl) && class_exists($_ctrl)) {
                $_routes['controller'] = $_ctrl;
                $this->setController(new $_ctrl(CarteBlanche::getContainer()));
            } else {
                trigger_error("Controller 'Error' can't be found!", E_USER_ERROR);
            }

            // don't execute `shutdown` kernel steps
            CarteBlanche::getContainer()->get('kernel')
                ->setShutdown(false);

            return CodeHelper::fetchArguments(
                $action, $params, $this->getController()
            );
        } else {
            if (!empty($exception)) {
                if (!isset($params['message'])) $params['message'] = '';
                $params['message'] .= method_exists($exception, 'getAppMessage') ?
                    $exception->getAppMessage() : $exception->getMessage();
            }
            $debug = \CarteBlanche\App\Debugger::getInstance();
            $this->renderDebug($params, null, false);
            $params['title'] = $debug->getDebuggerTitle();
            $tpl = 'profiler/template_profiler';

            // don't execute `shutdown` kernel steps
//            CarteBlanche::getContainer()->get('kernel')->setShutdown(false);

            return $this->view($tpl, $params, true, true);
        }
    }