Ejemplo n.º 1
0
 public function render()
 {
     $request = $this->_getController();
     $ctrl = new ErrorController($this->request, $this->eventManager);
     if (!Configure::read('debug')) {
         $this->_template = 'error_fatal';
     }
     $action = $this->request->action;
     if ($this->request->prefix) {
         $ctrl->layout = $this->request->prefix;
         $action = $this->request->prefix . '_' . $action;
     }
     $controller = ucfirst($this->request->controller);
     $action = $action;
     $error = $this->message;
     $code = $this->code;
     $file = $this->file;
     $line = $this->line;
     $ctrl->set(compact('controller', 'action', 'error', 'code', 'file', 'line'));
     if (isset($this->_template)) {
         $this->response->body($ctrl->render('/Error/' . $this->_template));
     } else {
         $this->response->body($ctrl->render('/Error/' . $this->code));
     }
     $this->response->send();
 }
Ejemplo n.º 2
0
 private static function Error($message = NULL)
 {
     if (class_exists('\\Controller\\ErrorController')) {
         $app = new \Controller\ErrorController(Request::getInstance());
         return $app->index($message);
     } else {
         return 'Error: ' . $message;
     }
 }