Skip to content

Commit

Permalink
Bugfix: Throw 404 (instead of 500) if site wasn't found
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikdro committed Feb 9, 2022
1 parent 6374008 commit 286f421
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Classes/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Neos\Flow\Http\Component\SetHeaderComponent;
use Neos\Flow\Mvc\Controller\RestController;
use Neos\Flow\Mvc\View\JsonView;
use Neos\Neos\Controller\Exception\NodeNotFoundException;
use Neos\Neos\View\FusionView;
use Neos\Flow\Annotations as Flow;

Expand Down Expand Up @@ -53,12 +54,18 @@ public function initializeAction()
}

/**
* @param NodeInterface $siteNode
* @param NodeInterface|null $siteNode
* @return void
* @throws NodeNotFoundException
* @throws \Neos\ContentRepository\Exception\NodeException
* @throws \Neos\Eel\Exception
*/
public function renderCookieSettingsAction(NodeInterface $siteNode)
public function renderCookieSettingsAction(NodeInterface $siteNode = null)
{
if (!$siteNode instanceof NodeInterface) {
throw new NodeNotFoundException('The given site was not found', 1644389565);
}

$this->view->setVariablesToRender(['html', 'needsRenew']);

$q = new FlowQuery([$siteNode]);
Expand Down

0 comments on commit 286f421

Please sign in to comment.