Skip to content

Commit 28429a5

Browse files
committed
[ErrorCatcher] some cleanup and better doc
1 parent 38d18eb commit 28429a5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

EventListener/DebugHandlersListener.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Symfony\Component\Console\Event\ConsoleEvent;
1717
use Symfony\Component\Console\Output\ConsoleOutputInterface;
1818
use Symfony\Component\ErrorCatcher\ErrorHandler;
19-
use Symfony\Component\ErrorCatcher\ErrorRenderer\ErrorRenderer;
19+
use Symfony\Component\ErrorCatcher\ErrorRenderer\ErrorFormatter;
2020
use Symfony\Component\ErrorCatcher\ErrorRenderer\HtmlErrorRenderer;
2121
use Symfony\Component\ErrorCatcher\Exception\ErrorRendererNotFoundException;
2222
use Symfony\Component\ErrorCatcher\ExceptionHandler;
@@ -46,7 +46,7 @@ class DebugHandlersListener implements EventSubscriberInterface
4646
private $fileLinkFormat;
4747
private $scope;
4848
private $charset;
49-
private $errorRenderer;
49+
private $errorFormatter;
5050
private $firstCall = true;
5151
private $hasTerminatedWithException;
5252

@@ -59,7 +59,7 @@ class DebugHandlersListener implements EventSubscriberInterface
5959
* @param string|FileLinkFormatter|null $fileLinkFormat The format for links to source files
6060
* @param bool $scope Enables/disables scoping mode
6161
*/
62-
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, ?int $throwAt = E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, string $charset = null, ErrorRenderer $errorRenderer = null)
62+
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, ?int $throwAt = E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, string $charset = null, ErrorFormatter $errorFormatter = null)
6363
{
6464
$this->exceptionHandler = $exceptionHandler;
6565
$this->logger = $logger;
@@ -69,7 +69,7 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $
6969
$this->fileLinkFormat = $fileLinkFormat;
7070
$this->scope = $scope;
7171
$this->charset = $charset;
72-
$this->errorRenderer = $errorRenderer;
72+
$this->errorFormatter = $errorFormatter;
7373
}
7474

7575
/**
@@ -167,16 +167,16 @@ public function onKernelException(GetResponseForExceptionEvent $event)
167167

168168
$debug = $this->scream && $this->scope;
169169
$controller = function (Request $request) use ($debug) {
170-
if (null === $this->errorRenderer) {
171-
$this->errorRenderer = new ErrorRenderer([new HtmlErrorRenderer($debug, $this->charset, $this->fileLinkFormat)]);
170+
if (null === $this->errorFormatter) {
171+
$this->errorFormatter = new ErrorFormatter([new HtmlErrorRenderer($debug, $this->charset, $this->fileLinkFormat)]);
172172
}
173173

174174
$e = $request->attributes->get('exception');
175175

176176
try {
177-
return new Response($this->errorRenderer->render($e, $request->getRequestFormat()), $e->getStatusCode(), $e->getHeaders());
177+
return new Response($this->errorFormatter->render($e, $request->getRequestFormat()), $e->getStatusCode(), $e->getHeaders());
178178
} catch (ErrorRendererNotFoundException $_) {
179-
return new Response($this->errorRenderer->render($e), $e->getStatusCode(), $e->getHeaders());
179+
return new Response($this->errorFormatter->render($e), $e->getStatusCode(), $e->getHeaders());
180180
}
181181
};
182182

0 commit comments

Comments
 (0)