fjtirado commented on code in PR #3250:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3250#discussion_r1383109785
##########
kogito-serverless-workflow/kogito-serverless-workflow-builder/src/main/java/org/kie/kogito/serverless/workflow/utils/TimeoutsConfigResolver.java:
##########
@@ -45,26 +47,30 @@ public static String resolveEventTimeout(State state,
Workflow workflow) {
String.format(INVALID_EVENT_TIMEOUT_FOR_STATE_ERROR,
timeouts.getEventTimeout(),
state.getName(),
- workflow.getName()));
+ workflow.getName()),
+ workflow.getExpressionLang());
return timeouts.getEventTimeout();
} else {
timeouts = workflow.getTimeouts();
if (timeouts != null && timeouts.getEventTimeout() != null) {
validateDuration(timeouts.getEventTimeout(),
String.format(INVALID_EVENT_TIMEOUT_FOR_WORKFLOW_ERROR,
timeouts.getEventTimeout(),
- workflow.getName()));
+ workflow.getName()),
+ workflow.getExpressionLang());
return timeouts.getEventTimeout();
}
}
return null;
}
- private static void validateDuration(String value, String message) {
- try {
- Duration.parse(value);
- } catch (DateTimeParseException e) {
- throw new IllegalArgumentException(message, e);
+ private static void validateDuration(String value, String message, String
exprLanguage) {
+ if (!ExpressionHandlerFactory.get(exprLanguage, value).isValid()) {
+ try {
+ Duration.parse(value);
+ } catch (DateTimeParseException e) {
+ throw new IllegalArgumentException(message, e);
Review Comment:
We can improve the message to show "the provided duration is neither a valid
expression or a valid duration", wdyt?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]