/** * Handle an incoming web request. */ public function handleRequest() { try { $this->response = parent::handleRequest(); } catch (HttpException $ex) { $this->config->set('page_title', 'Error'); $view = new View('exception'); $view->exception = $ex; $this->response->setResponseCode($ex->getErrorCode()); $this->response->setContent($view->render()); } catch (\Exception $ex) { $this->config->set('page_title', 'Error'); $view = new View('exception'); $view->exception = $ex; $this->response->setResponseCode(500); $this->response->setContent($view->render()); } if (View::exists('layout') && $this->response->hasLayout()) { $view = new View('layout'); $pageTitle = $this->config->get('page_title', null); if (!is_null($pageTitle)) { $view->title = $pageTitle; } $view->content = $this->response->getContent(); $this->response->setContent($view->render()); } return $this->response; }
/** * Handle an incoming web request. * * @return b8\b8\Http\Response|Response */ public function handleRequest() { try { $this->response = parent::handleRequest(); } catch (HttpException $ex) { $this->config->set('page_title', 'Error'); $view = new View('exception'); $view->exception = $ex; $this->response->setResponseCode($ex->getErrorCode()); $this->response->setContent($view->render()); } catch (\Exception $ex) { $this->config->set('page_title', 'Error'); $view = new View('exception'); $view->exception = $ex; $this->response->setResponseCode(500); $this->response->setContent($view->render()); } if ($this->response->hasLayout() && $this->controller->layout) { $this->setLayoutVariables($this->controller->layout); $this->controller->layout->content = $this->response->getContent(); $this->response->setContent($this->controller->layout->render()); } return $this->response; }
/** * Handle the request * * @return mixed * @throws \b8\Exception\HttpException * @throws \Exception * @throws \Exception */ public function handleRequest() { try { $rtn = parent::handleRequest(); if (extension_loaded('newrelic')) { $site = $this->toPhpName($this->config->get('site.name')); $controller = $this->toPhpName($this->route['controller']); $action = $this->toPhpName($this->route['action']); newrelic_name_transaction($site . '.' . $controller . '.' . $action); } } catch (HttpException $ex) { if (defined('CMS_ENV') && CMS_ENV == 'development' || array_key_exists('ex', $_GET)) { throw $ex; } $rtn = $this->handleHttpError($ex->getErrorCode()); } catch (Exception $ex) { if (defined('CMS_ENV') && CMS_ENV == 'development' || array_key_exists('ex', $_GET)) { throw $ex; } $rtn = $this->handleHttpError(500); } return $rtn; }