Skip to content

Commit

Permalink
messages up
Browse files Browse the repository at this point in the history
  • Loading branch information
brig committed Feb 5, 2025
1 parent 2b58b32 commit 34c53f3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public void shouldLogExceptionStackTraceWhenExpressionThrowsException() throws E
}

@Test
@IgnoreSerializationAssert
public void shouldLogExceptionStackTraceWhenTaskThrowsExceptionFromParallel() throws Exception {
runtime.deploy("logExceptionTests/fromParallel");

Expand Down Expand Up @@ -144,6 +145,7 @@ public void noStacktraceForUserDefinedExceptionFromExpression() throws Exception
}

@Test
@IgnoreSerializationAssert
public void noStacktraceForUserDefinedExceptionFromTaskParallel() throws Exception {
runtime.deploy("logExceptionTests/userDefinedExceptionFromTaskParallel");

Expand Down Expand Up @@ -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") + ".*");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public void throwStepShouldContainErrorDescription() throws Exception {
}

@Test
@IgnoreSerializationAssert
public void loopStepShouldLogErrorInProperLogSegment() throws Exception {
deploy("logSegments/taskErrorWithLoop");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* =====
*/

import com.walmartlabs.concord.runtime.v2.sdk.UserDefinedException;
import org.apache.commons.text.similarity.LevenshteinDistance;

import javax.el.ELException;
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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'"));
}
}

Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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'"));
}
}

Expand Down

0 comments on commit 34c53f3

Please sign in to comment.