Skip to content

Commit

Permalink
only handling non-ajax requests in exception handler at the moment. r…
Browse files Browse the repository at this point in the history
…efs #1789
  • Loading branch information
craigh committed Dec 6, 2014
1 parent 8a7185a commit bbcdebc
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,23 @@ public function onKernelException(GetResponseForExceptionEvent $event)
// for BC only, remove in 2.0.0
$this->handleLegacyExceptionEvent($event);

$exception = $event->getException();
$userLoggedIn = UserUtil::isLoggedIn();
do {
if ($exception instanceof AccessDeniedException) {
$this->handleAccessDeniedException($event, $userLoggedIn);
} elseif ($exception instanceof RouteNotFoundException) {
if ($userLoggedIn) {
$this->handleRouteNotFoundException($event);
if (!$event->getRequest()->isXmlHttpRequest()) {
$exception = $event->getException();
$userLoggedIn = UserUtil::isLoggedIn();
do {
if ($exception instanceof AccessDeniedException) {
$this->handleAccessDeniedException($event, $userLoggedIn);
} elseif ($exception instanceof RouteNotFoundException) {
if ($userLoggedIn) {
$this->handleRouteNotFoundException($event);
}
}
}
// list and handle additional exceptions here
} while (null !== $exception = $exception->getPrevious());
// list and handle additional exceptions here
} while (null !== $exception = $exception->getPrevious());

// force all exception to render in BC theme (remove in 2.0.0)
$event->getRequest()->attributes->set('_legacy', true);
// force all exception to render in BC theme (remove in 2.0.0)
$event->getRequest()->attributes->set('_legacy', true);
}
}

/**
Expand Down

0 comments on commit bbcdebc

Please sign in to comment.