Skip to content

Commit

Permalink
#224 support the exception retrival
Browse files Browse the repository at this point in the history
Signed-off-by: Emily Jiang <emijiang@uk.ibm.com>
  • Loading branch information
Emily-Jiang committed Mar 7, 2018
1 parent 1822b78 commit 34ea6a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,11 @@ public interface ExecutionContext {
*
*/
public Object[] getParameters();

/**
* Returns the failure of the method execution
* @return the failure of the method execution
*/
public Throwable getFailure();

}
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ public void testClassLevelFallbackSuccess() {
String result = fallbackClassLevelClient.serviceB();
Assert.assertTrue(result.contains("second fallback for serviceB"),
"The message should be \"second fallback for serviceB\"");
Assert.assertTrue(result.contains(RuntimeException.class.getName()),
"The message should be " + RuntimeException.class.getName());

}
catch (RuntimeException ex) {
Assert.fail("serviceB should not throw a RuntimeException in testFallbackSuccess");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class SecondStringFallbackHandler implements FallbackHandler<String> {

@Override
public String handle(ExecutionContext context) {
return "second fallback for " + context.getMethod().getName();
return "second fallback for " + context.getMethod().getName() + context.getFailure().getClass().getName();
}

}

0 comments on commit 34ea6a5

Please sign in to comment.