/** * @param Exception $e */ protected function _setErrorContent(Exception $e) { $this->responseCode = !empty(\Symfony\Component\HttpFoundation\Response::$statusTexts[$e->getCode()]) ? $e->getCode() : 500; $templatePath = PageBuilder::themePath() . 'errors.' . $this->responseCode; // display error loading page event(new LoadErrorTemplate($templatePath)); if (View::exists($templatePath)) { $this->_setHtmlContentType(); $this->responseContent = View::make($templatePath, ['e' => $e, 'error' => $e->getMessage()])->render(); } else { $this->responseContent = $e->getMessage(); } }