Skip to content

Commit

Permalink
Merge pull request #39 from Flowpack/bugfix/catchAndEnhanceErrorsCaus…
Browse files Browse the repository at this point in the history
…edInEelExpression

BUGFIX: catch and enhance errors caused in EelExpression
  • Loading branch information
Sebobo committed May 30, 2023
2 parents 48589d9 + 7d45012 commit 1785879
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Classes/Service/EelEvaluationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Flowpack\NodeTemplates\Service;

use Neos\Eel\ParserException;
use Neos\Flow\Annotations as Flow;
use Neos\Eel\Utility as EelUtility;
use Neos\Eel\CompilingEvaluator;
Expand Down Expand Up @@ -42,7 +43,12 @@ public function evaluateEelExpression($expression, $contextVariables)
$this->defaultContextVariables = EelUtility::getDefaultContextVariables($this->defaultContext);
}
$contextVariables = array_merge($this->defaultContextVariables, $contextVariables);
return EelUtility::evaluateEelExpression($expression, $this->eelEvaluator, $contextVariables);
try {
return EelUtility::evaluateEelExpression($expression, $this->eelEvaluator, $contextVariables);
} catch (ParserException $parserException) {
throw new \RuntimeException('EEL Expression in NodeType template could not be parsed.', 1684788574212, $parserException);
} catch (\Exception $exception) {
throw new \RuntimeException(sprintf('EEL Expression "%s" in NodeType template caused an error.', $expression), 1684761760723, $exception);
}
}

}
}

0 comments on commit 1785879

Please sign in to comment.