/** * Run the site */ public function run() { ob_start(); try { // Handle the URL route $this->_router->handleRequest($this->_request); // Display the site $this->display($this->_request->controllerName, $this->_request->actionName); } catch (\Exception $error) { // An error occured if (ob_get_length()) { ob_end_clean(); } // Display the default action of the error controller try { $this->_view->message = $error->getMessage(); $this->display('error', 'index'); } catch (\Exception $errorForError) { if (ob_get_length()) { ob_end_clean(); } trigger_error($errorForError->getMessage()); } } }