Closed Oktopuce closed 2 months ago
I would argue that in this case it's desirable to get an exception and undesirable to suppress all warning/error output when a non-existing page is passed. Otherwise you're just left clueless about why you get an empty root line.
I suggest using v:try
around the root line extracting ViewHelper - this also lets you render an alternative when this exception is raised.
I made the decision to reject this - it's undesirable to have this API suppress warnings about unreadable pages. See https://github.com/FluidTYPO3/vhs/pull/1906#issuecomment-2236564156.
I have checked that the bug exists in the
dev-development
branch Yes.I have checked that there are no already open issues or recently closed issues about this bug Yes.
Describe the bug When you're trying to get the root line of a page that doesn't exist, a
PageNotFoundException
exception is thrown:(1/1) #1343589451 TYPO3\CMS\Core\Exception\Page\PageNotFoundException
To Reproduce Steps to reproduce the behavior:
try { /* @var RootlineUtility $rootLineUtility / $rootLineUtility = GeneralUtility::makeInstance(RootlineUtility::class, $pageUid); $rootline = $rootLineUtility->get(); } catch (PageNotFoundException $e) { return []; }