Skip to content
Snippets Groups Projects

Issue #3046872 catch ResourceNotFoundException

Closed Malcolm Young requested to merge issue/facets-3046872:3046872-base-path-ajax-v2 into 2.0.x
2 files
+ 10
2
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -14,6 +14,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RouterInterface;
/**
@@ -135,7 +136,13 @@ class FacetBlockAjaxController extends ControllerBase {
$processed_request = Request::create($processed);
$this->currentPath->setPath($processed_request->getPathInfo());
$request->attributes->add($this->router->matchRequest($new_request));
try {
$request->attributes->add($this->router->matchRequest($new_request));
}
catch (ResourceNotFoundException $exception) {
throw new NotFoundHttpException('No route found for new facets block ajax request.');
}
$this->currentRouteMatch->resetRouteMatch();
$request_stack->push($new_request);
Loading