/** * {@inheritdoc} */ public function execute(\Exception $exception) { error_log($exception->getMessage() . " " . $exception->getFile() . "(" . $exception->getLine() . ")"); if (!$this->environment->isDebug()) { return; } $presenter = new HTTPErrorPresenter($this->environment); $response = new Response(); $response->setContent($exception); $request = new EmptyRequest('', null); $presenter->render($request, $response); }
/** * {@inheritdoc} */ public function execute(\Exception $exception) { if (!$this->dependencyInjection->get('environment')->isSilent()) { error_log($exception->getMessage() . " " . $exception->getFile() . "(" . $exception->getLine() . ")"); } $presenter = $this->getPresenter($this->request->getUrl()); $response = new Response(); $response->setStatusCode(500); $response->setContent($exception); if ($exception instanceof HTTPException) { $response->setStatusCode($exception->getStatusCode()); } $event = new ExecutePresenterEvent($this->request, $response); $this->dependencyInjection->get('eventManager')->fire('executePresenter', $event); $presenter->render($this->request, $response); }
/** * @return Response * @throws ActionNotFoundException */ private function invokeController() { $eventManager = $this->container->getEventManager(); $controller = new $this->className($this->request, $this->container); if (!is_callable([$controller, $this->methodName])) { throw new ActionNotFoundException($this->className, $this->methodName); } $response = null; $controllerData = call_user_func_array([$controller, $this->methodName], $this->request->getArguments()); if ($controllerData instanceof Response) { $response = $controllerData; } else { $response = new Response(); $response->setContent($controllerData); } if (!$response->getPresenter()) { $response->setPresenter($this->getPresenter()); } $event = new ExecutedActionEvent($this->request, $response); $eventManager->fire('executedAction', $event); return $response; }