microsoft / microsoft/durabletask-java
Only the innermost exception is returned when activity functions throw
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Java
- Estrelas
- 29
- Forks
- 18
- Merge médio
- 1d 10h
- PRs com merge (30d)
- 2
Descrição
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:
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece rastreando os FailureDetails retornados para falhas de activity-function e como retryContext.getLastFailure() os expõe. Compare o comportamento do Java SDK com as outras implementações Durable nas linguagens mencionadas na issue. Considera-se concluído quando o erro de usuário mais externo, seu tipo totalmente qualificado e todas as falhas internas aninhadas estiverem disponíveis para inspeção recursiva.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- java
- Domínio
- backend
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 45/100