-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add ExtraProvider for Fusion rendering paths
Showing
4 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Netlogix\Sentry\Scope\Extra; | ||
|
||
use Neos\Flow\Aop\JoinPointInterface; | ||
use Neos\Flow\Annotations as Flow; | ||
use Neos\Fusion\Exception\RuntimeException as FusionRuntimeException; | ||
|
||
/** | ||
* @Flow\Scope("singleton") | ||
* @Flow\Aspect | ||
*/ | ||
final class FusionPathProvider implements ExtraProvider | ||
{ | ||
private array $fusionPaths = []; | ||
|
||
/** | ||
* @Flow\Before("setting(Netlogix.Sentry.featureFlags.fusionFeatures) && within(Neos\Fusion\Core\ExceptionHandlers\AbstractRenderingExceptionHandler) && method(.*->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; | ||
} | ||
|
||
public function getExtra(): array | ||
{ | ||
if (empty($this->fusionPaths)) { | ||
return []; | ||
} | ||
|
||
return [ | ||
'fusionPaths' => array_values(array_unique($this->fusionPaths)), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Netlogix: | ||
Sentry: | ||
featureFlags: | ||
# Set to true when Neos.Fusion is installed | ||
fusionFeatures: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters