Skip to content

Commit 7cb8ff4

Browse files
committed
TASK: Catch error because invalid property type
1 parent fa2865d commit 7cb8ff4

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ private function createTemplateFromTemplatePart(TemplatePart $templatePart): Tem
9191
$processedProperties = [];
9292
foreach ($templatePart->getRawConfiguration('properties') ?? [] as $propertyName => $value) {
9393
if (!is_scalar($value) && !is_null($value)) {
94-
throw new \InvalidArgumentException(sprintf('Template configuration properties can only hold int|float|string|bool|null. Property "%s" has type "%s"', $propertyName, gettype($value)), 1685725310730);
94+
$templatePart->getCaughtExceptions()->add(CaughtException::fromException(
95+
new \RuntimeException(sprintf('Template configuration properties can only hold int|float|string|bool|null. Property "%s" has type "%s"', $propertyName, gettype($value)), 1685725310730)
96+
));
97+
continue;
9598
}
9699
try {
97100
$processedProperties[$propertyName] = $templatePart->processConfiguration(['properties', $propertyName]);

Configuration/Testing/NodeTypes.Malformed.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
working: "working"
4444
nonDeclaredProperty: "hi"
4545
bar: "${'left open"
46+
nonEelArrayNotAllowed:
47+
not: allowed
4648
childNodes:
4749
whenAbort:
4850
type: 'Flowpack.NodeTemplates:Content.Text'

Tests/Functional/Fixtures/WithEvaluationExceptions.messages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"message": "Expression \"${'left open\" in \"properties.bar\" | EelException(The EEL expression \"${'left open\" was not a valid EEL expression. Perhaps you forgot to wrap it in ${...}?, 1410441849)",
1212
"severity": "ERROR"
1313
},
14+
{
15+
"message": "RuntimeException(Template configuration properties can only hold int|float|string|bool|null. Property \"nonEelArrayNotAllowed\" has type \"array\", 1685725310730)",
16+
"severity": "ERROR"
17+
},
1418
{
1519
"message": "Expression \"${parse \u00e4\u00fc\u00e4\u00f6 error}\" in \"childNodes.whenAbort.when\" | ParserException(Expression \"parse \u00e4\u00fc\u00e4\u00f6 error\" could not be parsed. Error starting at character 5: \" \u00e4\u00fc\u00e4\u00f6 error\"., 1327682383)",
1620
"severity": "ERROR"

0 commit comments

Comments
 (0)