When an activity function throws an exception, we return a FailureDetails but it only represents the innermost exception. Request changing this behavior to match the other durable language implementations returning the outermost user error and all inner errors recursively.
Repro code:
@FunctionName("CustomRetryActivityFunction")
publicStringcustomRetryActivityFunction(
@DurableOrchestrationTrigger(name = "ctx") TaskOrchestrationContextctx) {
TaskOptionsoptions = newTaskOptions(retryContext -> {
FailureDetailslastFailure = retryContext.getLastFailure();
if (lastFailure != null// BUG: Only the innermost failure is available in the Java SDK// BUG: isCausedBy() relies on Class.forName() but we do not provide the fully qualified class name// in the FailureDetails
&& lastFailure.getErrorType().equals("OverflowException")
// && lastFailure.isCausedBy(InvalidOperationException.class)// BUG: We do not implement inner failures in the Java SDK yet// && lastFailure.getInnerFailure() != null// && lastFailure.getInnerFailure().isCausedBy("java.lang.OverflowException")
&& retryContext.getLastAttemptNumber() < 3) {
returntrue;
}
returnfalse;
});
returnctx.callActivity("RaiseComplexException", ctx.getInstanceId(), options, String.class).await();
}
@FunctionName("RaiseComplexException")
publicStringraiseComplexException(
@DurableActivityTrigger(name = "instanceId") StringinstanceId,
finalExecutionContextcontext) throwsInvalidOperationException {
AtomicIntegercount = globalRetryCount.computeIfAbsent(instanceId, k -> newAtomicInteger(0));
intcurrent = count.incrementAndGet();
if (current == 1) {
OverflowExceptioninner = newOverflowException("Inner exception message");
InvalidOperationExceptionex = newInvalidOperationException(
"This activity failed\r\nMore information about the failure", inner);
throwex;
} else {
return"Success";
}
}Result:

When an activity function throws an exception, we return a FailureDetails but it only represents the innermost exception. Request changing this behavior to match the other durable language implementations returning the outermost user error and all inner errors recursively.
Repro code:
Result: