/**
  * construct
  * @param Exception $exception the exception
  */
 public function __construct($exception)
 {
     $this->request = Request::getInstance();
     $save['controller'] = $this->request->controller;
     $this->request->controller = 'ErrorController';
     $save['action'] = $this->request->action;
     if (Config::getDebug()) {
         $this->request->action = 'error';
     } else {
         $this->request->action = 'error404';
     }
     $this->request->params = ['error' => $exception];
     $this->view = new MasterView();
     $this->view->set($save);
     $this->view->layout = 'error';
     $this->loadTools();
     $this->execute();
 }