microsoft / microsoft/durabletask-java

FailureDetails.IsCausedBy throws

Đang mở
#239 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

P1
Ngôn ngữ chính
Java
Star
29
Fork
18
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
2

Mô tả

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();
    }
``

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu từ FailureDetails.isCausedBy() và lần theo cách kiểu lỗi của failure được tuần tự hóa và tái tạo khi được truy cập thông qua retryContext. Sử dụng custom retry handler và exception scenario được cung cấp để tái hiện failure. Hoàn tất khi isCausedBy() có thể đánh giá thành công lớp của nguyên nhân, với coverage cho trường hợp đã tái hiện.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
backend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.