FailureDetails.IsCausedBy throws

未關閉
#239 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
java
領域
backend

研究方向

從 FailureDetails.isCausedBy() 開始,追蹤 failure 的錯誤類型在透過 retryContext 存取時如何被序列化和重建。使用提供的自訂重試處理器和例外情境來重現此 failure。完成的標準是 isCausedBy() 能夠成功評估 cause class,並且為重現的案例提供涵蓋率。

由索引模型根據 Issue 內容生成。

描述

P1

When an activity function throws an exception, and it is caught by a custom retry handler in an orchestrator, the retryContext allows accessing the FailureDetails for analysis of the failure. However, attempting to use the FailureDetails.isCausedBy() method will never succeed, as it internally is implemented using Class.forName() which requires the fully-qualified exception class name but FailureDetails does not have this information serialized, just the simple exception class name.

Repro:

    @FunctionName("CustomRetryActivityFunction")
    public String customRetryActivityFunction(
            @DurableOrchestrationTrigger(name = "ctx") TaskOrchestrationContext ctx) {
        TaskOptions options = new TaskOptions(retryContext -> {
            FailureDetails lastFailure = retryContext.getLastFailure();
            if (lastFailure != null
                    && lastFailure.getErrorType().equals("OverflowException")
                    // This line should work, but doesn't
                    // && lastFailure.isCausedBy(InvalidOperationException.class)
                    && retryContext.getLastAttemptNumber() < 3) {
                return true;
            }
            return false;
        });
        return ctx.callActivity("RaiseComplexException", ctx.getInstanceId(), options, String.class).await();
    }
``
主要語言
Java
星號
29
分支
18
平均合併
1 天 10 小時
30 天內合併 PR
2

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

microsoft/durabletask-java 的其他 Issue

查看 microsoft/durabletask-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。