From 5d3d580499d564aefd4098bb59cfc5848859b76b Mon Sep 17 00:00:00 2001 From: Lars Lauger Date: Tue, 20 Aug 2024 09:15:01 +0200 Subject: [PATCH] feat: Add ExtraProvider for Fusion rendering paths --- Classes/Scope/Extra/FusionPathProvider.php | 69 ++++++++++++++++++++++ Configuration/Settings.Providers.yaml | 1 + 2 files changed, 70 insertions(+) create mode 100644 Classes/Scope/Extra/FusionPathProvider.php diff --git a/Classes/Scope/Extra/FusionPathProvider.php b/Classes/Scope/Extra/FusionPathProvider.php new file mode 100644 index 0000000..b016a55 --- /dev/null +++ b/Classes/Scope/Extra/FusionPathProvider.php @@ -0,0 +1,69 @@ +handleRenderingException())") + */ + public function beforeFusionExceptionHandling(JoinPointInterface $joinPoint): void + { + if (!$joinPoint->isMethodArgument('fusionPath')) { + return; + } + + $fusionPath = $joinPoint->getMethodArgument('fusionPath'); + if ($joinPoint->isMethodArgument('exception')) { + $exception = $joinPoint->getMethodArgument('exception'); + if ($exception instanceof FusionRuntimeException) { + $fusionPath = $exception->getFusionPath(); + } + } + + $this->fusionPaths[] = $fusionPath; + } + + /** + * @Flow\Around("method(protected Neos\Flow\Aop\Pointcut\PointcutSettingFilter->parseConfigurationOptionPath())") + */ + public function catchPointcutSettingException(JoinPointInterface $joinPoint): void + { + try { + $joinPoint->getAdviceChain()->proceed($joinPoint); + } catch (InvalidPointcutExpressionException $exception) { + if ($joinPoint->isMethodArgument('settingComparisonExpression')) { + $settingComparisonExpression = $joinPoint->getMethodArgument('settingComparisonExpression'); + if ($settingComparisonExpression === 'Neos.Fusion.rendering.exceptionHandler' && $exception->getCode() === 1230035614) { + return; + } + } + + throw $exception; + } + } + + public function getExtra(): array + { + if (empty($this->fusionPaths)) { + return []; + } + + return [ + 'fusionPaths' => array_values(array_unique($this->fusionPaths)), + ]; + } +} diff --git a/Configuration/Settings.Providers.yaml b/Configuration/Settings.Providers.yaml index d718c38..fbfe62b 100644 --- a/Configuration/Settings.Providers.yaml +++ b/Configuration/Settings.Providers.yaml @@ -7,6 +7,7 @@ Netlogix: 'Netlogix\Sentry\Scope\Environment\FlowSettings': true extra: + 'Netlogix\Sentry\Scope\Extra\FusionPathProvider': true 'Netlogix\Sentry\Scope\Extra\ReferenceCodeProvider': true release: