Skip to content

Commit aad8b7c

Browse files
committed
Function split
1 parent 1a948d0 commit aad8b7c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/ErrorHandler.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,17 @@ public function exceptionHandler(Throwable $exception): void
300300
}
301301
// @codeCoverageIgnoreEnd
302302

303+
echo $this->renderHtmlException($exception);
304+
}
305+
306+
public function renderHtmlException(Throwable $exception): string
307+
{
303308
$ajax = (isset($_SERVER) && isset($_SERVER['X_REQUESTED_WITH']) && 'XMLHttpRequest' === $_SERVER['X_REQUESTED_WITH']);
304309
$output = '';
305310
if (! $ajax) {
306-
$output .= '<!DOCTYPE html><html><head><title>500: Errore interno</title></head><body>';
311+
$output .= '<!DOCTYPE html><html><head><title>500: Internal Server Error</title></head><body>';
307312
}
308-
$output .= '<h1>500: Errore interno</h1>';
313+
$output .= '<h1>500: Internal Server Error</h1>';
309314
$output .= \PHP_EOL;
310315
if ($this->displayErrors()) {
311316
$currentEx = $exception;
@@ -333,7 +338,7 @@ public function exceptionHandler(Throwable $exception): void
333338
$output .= '</body></html>';
334339
}
335340

336-
echo $output;
341+
return $output;
337342
}
338343

339344
private function outputError(string $text): void

0 commit comments

Comments
 (0)