Skip to content

Commit

Permalink
Merge pull request #1643 from bolt/fix/errorcontroller
Browse files Browse the repository at this point in the history
Fix Errorcontroller adding Exception when it shouldn't.
  • Loading branch information
I-Valchev authored Jul 21, 2020
2 parents c24a596 + 7ac77e4 commit 1a62b74
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Controller/ErrorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1a62b74

Please sign in to comment.