| @@ 73-101 (lines=29) @@ | ||
| 70 | * |
|
| 71 | * @return string |
|
| 72 | */ |
|
| 73 | protected function renderHtmlErrorMessage(\Exception $exception) |
|
| 74 | { |
|
| 75 | $title = 'Slim Application Error'; |
|
| 76 | ||
| 77 | if ($this->displayErrorDetails) { |
|
| 78 | $html = '<p>The application could not run because of the following error:</p>'; |
|
| 79 | $html .= '<h2>Details</h2>'; |
|
| 80 | $html .= $this->renderHtmlException($exception); |
|
| 81 | ||
| 82 | while ($exception = $exception->getPrevious()) { |
|
| 83 | $html .= '<h2>Previous exception</h2>'; |
|
| 84 | $html .= $this->renderHtmlExceptionOrError($exception); |
|
| 85 | } |
|
| 86 | } else { |
|
| 87 | $html = '<p>A website error has occurred. Sorry for the temporary inconvenience.</p>'; |
|
| 88 | } |
|
| 89 | ||
| 90 | $output = sprintf( |
|
| 91 | "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" . |
|
| 92 | "<title>%s</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana," . |
|
| 93 | "sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{" . |
|
| 94 | "display:inline-block;width:65px;}</style></head><body><h1>%s</h1>%s</body></html>", |
|
| 95 | $title, |
|
| 96 | $title, |
|
| 97 | $html |
|
| 98 | ); |
|
| 99 | ||
| 100 | return $output; |
|
| 101 | } |
|
| 102 | ||
| 103 | /** |
|
| 104 | * Render exception as HTML. |
|
| @@ 72-100 (lines=29) @@ | ||
| 69 | * |
|
| 70 | * @return string |
|
| 71 | */ |
|
| 72 | protected function renderHtmlErrorMessage(\Throwable $error) |
|
| 73 | { |
|
| 74 | $title = 'Slim Application Error'; |
|
| 75 | ||
| 76 | if ($this->displayErrorDetails) { |
|
| 77 | $html = '<p>The application could not run because of the following error:</p>'; |
|
| 78 | $html .= '<h2>Details</h2>'; |
|
| 79 | $html .= $this->renderHtmlError($error); |
|
| 80 | ||
| 81 | while ($error = $error->getPrevious()) { |
|
| 82 | $html .= '<h2>Previous error</h2>'; |
|
| 83 | $html .= $this->renderHtmlError($error); |
|
| 84 | } |
|
| 85 | } else { |
|
| 86 | $html = '<p>A website error has occurred. Sorry for the temporary inconvenience.</p>'; |
|
| 87 | } |
|
| 88 | ||
| 89 | $output = sprintf( |
|
| 90 | "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" . |
|
| 91 | "<title>%s</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana," . |
|
| 92 | "sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{" . |
|
| 93 | "display:inline-block;width:65px;}</style></head><body><h1>%s</h1>%s</body></html>", |
|
| 94 | $title, |
|
| 95 | $title, |
|
| 96 | $html |
|
| 97 | ); |
|
| 98 | ||
| 99 | return $output; |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| 103 | * Render error as HTML. |
|