diff --git a/core-bundle/src/EventListener/ExceptionConverterListener.php b/core-bundle/src/EventListener/ExceptionConverterListener.php index 2dc3574be8f..a56ca8136b8 100644 --- a/core-bundle/src/EventListener/ExceptionConverterListener.php +++ b/core-bundle/src/EventListener/ExceptionConverterListener.php @@ -67,7 +67,7 @@ public function onKernelException(ExceptionEvent $event): void } } - private function getTargetClass(\Exception $exception): ?string + private function getTargetClass(\Throwable $exception): ?string { foreach (self::MAPPER as $source => $target) { if ($exception instanceof $source) { @@ -78,7 +78,7 @@ private function getTargetClass(\Exception $exception): ?string return null; } - private function convertToHttpException(\Exception $exception, string $target): ?HttpException + private function convertToHttpException(\Throwable $exception, string $target): ?HttpException { switch ($target) { case 'AccessDeniedHttpException': diff --git a/core-bundle/src/EventListener/PrettyErrorScreenListener.php b/core-bundle/src/EventListener/PrettyErrorScreenListener.php index 7516b1af995..cee1bc5b8e4 100644 --- a/core-bundle/src/EventListener/PrettyErrorScreenListener.php +++ b/core-bundle/src/EventListener/PrettyErrorScreenListener.php @@ -231,7 +231,7 @@ private function getTemplateParameters(string $view, int $statusCode, ExceptionE ]; } - private function logException(\Exception $exception): void + private function logException(\Throwable $exception): void { if (Kernel::VERSION_ID >= 40100 || null === $this->logger || !$this->isLoggable($exception)) { return; @@ -240,7 +240,7 @@ private function logException(\Exception $exception): void $this->logger->critical('An exception occurred.', ['exception' => $exception]); } - private function isLoggable(\Exception $exception): bool + private function isLoggable(\Throwable $exception): bool { do { if ($exception instanceof InvalidRequestTokenException) { @@ -251,7 +251,7 @@ private function isLoggable(\Exception $exception): bool return true; } - private function getStatusCodeForException(\Exception $exception): int + private function getStatusCodeForException(\Throwable $exception): int { if ($exception instanceof HttpException) { return (int) $exception->getStatusCode();