Skip to content

Commit

Permalink
TASK: Throw dedicated SiteDetectionFailedException exception
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Feb 16, 2024
1 parent 3b3ceb9 commit 9161acc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Neos\Neos\FrontendRouting\SiteDetection;

/**
* Neos was probably not setup yet.
* No existent site entity will for example cause this issue.
*/
class SiteDetectionFailedException extends \RuntimeException
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,13 @@ public static function fromRouteParameters(RouteParameters $routeParameters): se
$siteNodeName = $routeParameters->getValue(self::ROUTINGPARAMETER_SITENODENAME);
$contentRepositoryId = $routeParameters->getValue(self::ROUTINGPARAMETER_CONTENTREPOSITORYID);

if ($siteNodeName === null || $contentRepositoryId === null) {
throw new \RuntimeException(
if (!is_string($siteNodeName) || !is_string($contentRepositoryId)) {
throw new SiteDetectionFailedException(
'Current site and content repository could not be extracted from the Request.'
. ' The SiteDetectionMiddleware was not able to determine the site!'
. ' The SiteDetectionMiddleware was not able to determine the site!',
1699459565
);
}
assert(is_string($siteNodeName));
assert(is_string($contentRepositoryId));
return new self(
SiteNodeName::fromString($siteNodeName),
ContentRepositoryId::fromString($contentRepositoryId)
Expand Down

0 comments on commit 9161acc

Please sign in to comment.