From 34c53f3b22fef2c83cb7b03fd01e0e115c36b191 Mon Sep 17 00:00:00 2001 From: brig Date: Wed, 5 Feb 2025 16:02:02 -0500 Subject: [PATCH] messages up --- .../concord/runtime/v2/runner/LogExceptionsTest.java | 4 +++- .../concord/runtime/v2/runner/LogSegmentsTest.java | 1 + .../v2/runner/el/LazyExpressionEvaluator.java | 4 +++- .../v2/runner/el/MethodNotFoundException.java | 3 +-- .../v2/runner/el/ExpressionEvaluatorTest.java | 12 ++++++------ 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/runtime/v2/runner-test/src/test/java/com/walmartlabs/concord/runtime/v2/runner/LogExceptionsTest.java b/runtime/v2/runner-test/src/test/java/com/walmartlabs/concord/runtime/v2/runner/LogExceptionsTest.java index f4b33103e6..851e1bd9af 100644 --- a/runtime/v2/runner-test/src/test/java/com/walmartlabs/concord/runtime/v2/runner/LogExceptionsTest.java +++ b/runtime/v2/runner-test/src/test/java/com/walmartlabs/concord/runtime/v2/runner/LogExceptionsTest.java @@ -75,6 +75,7 @@ public void shouldLogExceptionStackTraceWhenExpressionThrowsException() throws E } @Test + @IgnoreSerializationAssert public void shouldLogExceptionStackTraceWhenTaskThrowsExceptionFromParallel() throws Exception { runtime.deploy("logExceptionTests/fromParallel"); @@ -144,6 +145,7 @@ public void noStacktraceForUserDefinedExceptionFromExpression() throws Exception } @Test + @IgnoreSerializationAssert public void noStacktraceForUserDefinedExceptionFromTaskParallel() throws Exception { runtime.deploy("logExceptionTests/userDefinedExceptionFromTaskParallel"); @@ -227,7 +229,7 @@ public void noStackTraceForVariableNotFound() throws Exception { } // error - assertLog(runtime.lastLog(), ".*" + quote("(concord.yaml): Error @ line: 3, col: 7. while evaluating expression '${unknown}': Can't find a variable 'unknown' used in '${unknown}'. Check if it is defined in the current scope. Details: ELResolver cannot handle a null base Object with identifier 'unknown'") + ".*"); + assertLog(runtime.lastLog(), ".*" + quote("(concord.yaml): Error @ line: 3, col: 7. while evaluating expression '${unknown}': Can't find a variable 'unknown'. Check if it is defined in the current scope. Details: ELResolver cannot handle a null base Object with identifier 'unknown'") + ".*"); // no stacktrace assertNoLog(runtime.lastLog(), ".*" + quote("at com.walmartlabs.concord.runtime.v2.runner.el.LazyExpressionEvaluator.evalExpr") + ".*"); diff --git a/runtime/v2/runner-test/src/test/java/com/walmartlabs/concord/runtime/v2/runner/LogSegmentsTest.java b/runtime/v2/runner-test/src/test/java/com/walmartlabs/concord/runtime/v2/runner/LogSegmentsTest.java index 64e78f04cf..edc328d262 100644 --- a/runtime/v2/runner-test/src/test/java/com/walmartlabs/concord/runtime/v2/runner/LogSegmentsTest.java +++ b/runtime/v2/runner-test/src/test/java/com/walmartlabs/concord/runtime/v2/runner/LogSegmentsTest.java @@ -82,6 +82,7 @@ public void throwStepShouldContainErrorDescription() throws Exception { } @Test + @IgnoreSerializationAssert public void loopStepShouldLogErrorInProperLogSegment() throws Exception { deploy("logSegments/taskErrorWithLoop"); diff --git a/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/el/LazyExpressionEvaluator.java b/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/el/LazyExpressionEvaluator.java index f795cc7a48..8caa5235ff 100644 --- a/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/el/LazyExpressionEvaluator.java +++ b/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/el/LazyExpressionEvaluator.java @@ -161,8 +161,10 @@ public FunctionMapper getFunctionMapper() { } throw new UserDefinedException(exceptionPrefix(expr) + errorMessage); - } catch (UserDefinedException e) { + } catch (MethodNotFoundException e) { throw new UserDefinedException(exceptionPrefix(expr) + e.getMessage()); + } catch (UserDefinedException e) { + throw new UserDefinedException(e.getMessage()); } catch (javax.el.ELException e) { if (e.getCause() instanceof com.sun.el.parser.ParseException pe) { throw new WrappedException("while parsing expression '" + expr + "': ", pe); diff --git a/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/el/MethodNotFoundException.java b/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/el/MethodNotFoundException.java index 53d384336d..380f066095 100644 --- a/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/el/MethodNotFoundException.java +++ b/runtime/v2/runner/src/main/java/com/walmartlabs/concord/runtime/v2/runner/el/MethodNotFoundException.java @@ -20,7 +20,6 @@ * ===== */ -import com.walmartlabs.concord.runtime.v2.sdk.UserDefinedException; import org.apache.commons.text.similarity.LevenshteinDistance; import javax.el.ELException; @@ -31,7 +30,7 @@ import java.util.List; import java.util.stream.Collectors; -public class MethodNotFoundException extends UserDefinedException { +public class MethodNotFoundException extends ELException { private static final long serialVersionUID = 1L; diff --git a/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/el/ExpressionEvaluatorTest.java b/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/el/ExpressionEvaluatorTest.java index fa0f87cbaa..fe8d036032 100644 --- a/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/el/ExpressionEvaluatorTest.java +++ b/runtime/v2/runner/src/test/java/com/walmartlabs/concord/runtime/v2/runner/el/ExpressionEvaluatorTest.java @@ -73,7 +73,7 @@ public void testStrictUndef() { ee.eval(ctx, "Hello ${name}", String.class); fail("exception expected"); } catch (RuntimeException e) { - assertThat(e.getMessage(), containsString("variable 'name' used in 'Hello ${name}'")); + assertThat(e.getMessage(), containsString("while evaluating expression 'Hello ${name}': Can't find a variable 'name'")); } // undef as null @@ -155,7 +155,7 @@ public void testEval1() { ee.evalAsMap(global(vars), input); fail("exception expected"); } catch (RuntimeException e) { - assertThat(e.getMessage(), containsString("variable 'y' used in '${y}'")); + assertThat(e.getMessage(), containsString("while evaluating expression '${y}': Can't find a variable 'y'")); } // undef -> x = null, z = null, y ...y3 = null @@ -183,7 +183,7 @@ public void testEval2() { ee.evalAsMap(global(vars), input); fail("exception expected"); } catch (RuntimeException e) { - assertThat(e.getMessage(), containsString("variable 'y' used in '${y}'")); + assertThat(e.getMessage(), containsString("while evaluating expression '${y}': Can't find a variable 'y'")); } // scope @@ -192,7 +192,7 @@ public void testEval2() { ee.evalAsMap(scope(vars), input); fail("exception expected"); } catch (RuntimeException e) { - assertThat(e.getMessage(), containsString("variable 'x' used in '${x}'")); + assertThat(e.getMessage(), containsString("while evaluating expression '${x}': Can't find a variable 'x'")); } } @@ -229,7 +229,7 @@ public void testEval3() { ee.evalAsMap(global(vars), input); fail("exception expected"); } catch (Exception e) { - assertThat(e.getMessage(), containsString("variable 'y' used in '${y}'")); + assertThat(e.getMessage(), containsString("while evaluating expression '${y}': Can't find a variable 'y'")); } verify(task, times(0)).foo(anyString()); @@ -298,7 +298,7 @@ public void testEval5() { try { ee.evalAsMap(scope(vars), input); } catch (RuntimeException e) { - assertThat(e.getMessage(), containsString("variable 'y1' used in '${y1}'")); + assertThat(e.getMessage(), containsString("while evaluating expression '${y1}': Can't find a variable 'y1'")); } }