Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtimev2: error message for process arguments evaluation #1086

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -278,4 +278,32 @@ public void noStacktraceForUserDefinedExceptionFromTaskParallelParallel() throws
assertNoLog(runtime.lastLog(), ".*" + quote("com.walmartlabs.concord.svm.ParallelExecutionException") + ".*");
assertNoLog(runtime.lastLog(), ".*" + quote("at com.walmartlabs.concord.runtime.v2.runner.vm.JoinCommand.execute") + ".*");
}


@Test
public void noStackTraceForArgsEvalError() throws Exception {
runtime.deploy("logExceptionTests/invalidArgs");

runtime.save(ProcessConfiguration.builder()
.putArguments("name", "${undefinedVariableName}")
.build());

try {
runtime.run();
fail("Exception expected");
} catch (Exception e) {
// ignore
}

var errorMessage = "[ERROR] Error while evaluating process arguments: while evaluating expression " +
"'${undefinedVariableName}': Can't find a variable 'undefinedVariableName'. " +
"Check if it is defined in the current scope. " +
"Details: ELResolver cannot handle a null base Object with identifier 'undefinedVariableName'";

// error
assertLog(runtime.lastLog(), ".*" + quote(errorMessage) + ".*");

// no stacktrace
assertNoLog(runtime.lastLog(), ".*" + quote("at com.walmartlabs.concord.runtime.v2") + ".*");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
flows:
default:
- log: "OK"
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ public ProcessSnapshot start(ProcessConfiguration processConfiguration, ProcessD

VM vm = createVM(processDefinition);
// update the global variables using the input map by running a special command
vm.run(state, new UpdateLocalsCommand(input)); // TODO merge with the cfg's arguments
try {
vm.run(state, new UpdateLocalsCommand(input)); // TODO merge with the cfg's arguments
} catch (RuntimeException e) {
log.error("Error while evaluating process arguments: {}", e.getMessage(), e);
throw e;
}
// start the normal execution
vm.start(state);

Expand All @@ -105,7 +110,12 @@ public ProcessSnapshot resume(ProcessSnapshot snapshot, Set<String> eventRefs, M
.filter(kv -> eventRefs.contains(kv.getValue()))
.map(Map.Entry::getKey)
.collect(Collectors.toList());
vm.run(state, new UpdateLocalsCommand(input, resumingThreads));
try {
vm.run(state, new UpdateLocalsCommand(input, resumingThreads));
} catch (RuntimeException e) {
log.error("Error while evaluating resume arguments: {}", e.getMessage(), e);
throw e;
}

// resume normally
vm.resume(state, eventRefs);
Expand All @@ -126,7 +136,13 @@ public ProcessSnapshot resume(ProcessSnapshot snapshot, Map<String, Object> inpu

VM vm = createVM(snapshot.processDefinition());
// update the global variables using the input map by running a special command
vm.run(state, new UpdateLocalsCommand(input));
try {
vm.run(state, new UpdateLocalsCommand(input));
} catch (RuntimeException e) {
log.error("Error while evaluating resume arguments: {}", e.getMessage(), e);
throw e;
}

// continue as usual
vm.start(state);

Expand Down