microsoft / microsoft/durabletask-java
Only the innermost exception is returned when activity functions throw
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Java
- Estrellas
- 29
- Forks
- 18
- Merge medio
- 1 d 10 h
- PR fusionados (30 d)
- 2
Descripción
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")
public String customRetryActivityFunction(
@DurableOrchestrationTrigger(name = "ctx") TaskOrchestrationContext ctx) {
TaskOptions options = new TaskOptions(retryContext -> {
FailureDetails lastFailure = 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) {
return true;
}
return false;
});
return ctx.callActivity("RaiseComplexException", ctx.getInstanceId(), options, String.class).await();
}
@FunctionName("RaiseComplexException")
public String raiseComplexException(
@DurableActivityTrigger(name = "instanceId") String instanceId,
final ExecutionContext context) throws InvalidOperationException {
AtomicInteger count = globalRetryCount.computeIfAbsent(instanceId, k -> new AtomicInteger(0));
int current = count.incrementAndGet();
if (current == 1) {
OverflowException inner = new OverflowException("Inner exception message");
InvalidOperationException ex = new InvalidOperationException(
"This activity failed\r\nMore information about the failure", inner);
throw ex;
} else {
return "Success";
}
}
Result:
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza siguiendo los FailureDetails devueltos para los fallos de activity-function y cómo retryContext.getLastFailure() los expone. Compara el comportamiento del Java SDK con las otras implementaciones de Durable para lenguajes mencionadas en la issue. Se considera terminado cuando el error de usuario más externo, su tipo completamente cualificado y todos los fallos internos anidados están disponibles para inspección recursiva.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- backend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100