diff --git a/src/Controller/ErrorController.php b/src/Controller/ErrorController.php index d89ad9bc0..48fe16c5a 100644 --- a/src/Controller/ErrorController.php +++ b/src/Controller/ErrorController.php @@ -48,7 +48,11 @@ public function showAction(Environment $twig, \Throwable $exception): Response $code = Response::HTTP_INTERNAL_SERVER_ERROR; } - $twig->addGlobal('exception', $exception); + try { + $twig->addGlobal('exception', $exception); + } catch (\LogicException $e) { + // Fine! We'll just _not_ add the exception to the global scope! + } if ($code === Response::HTTP_SERVICE_UNAVAILABLE || $this->isMaintenanceEnabled($code)) { $twig->addGlobal('exception', $exception);