public function send() { try { http_response_code($this->response_code); $this->view->render(); return; } catch (\Exception $e) { Logger::log($e); Response::sendError("default", 500); } die; }
public function handle(Request $request) { try { $response = $this->router->match($request); $this->request = $request; $response->process($this->container); return $response; } catch (NotFoundException $e) { Logger::log($e); Response::sendError("not_found", 404, $this->container); } catch (WrongRouteException $e) { Logger::log($e); Response::sendError("wrong_route", 404, $this->container); } catch (CSRFNotValidException $e) { Logger::log($e); Response::sendError("csrf_not_valid", 403, $this->container); } catch (\Exception $e) { Logger::log($e); Response::sendError("default", 500, $this->container); } die; }