Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement a custom retry handler when all useful information is lost? #2945

Open
thomaseyde opened this issue Oct 18, 2024 · 0 comments
Labels
P2 Priority 2

Comments

@thomaseyde
Copy link

In #2697 it is explained that activity exceptions will not be serialized.

With this decision, how are we supposed to implement custom retry handlers when there is no useful information to act upon?

I have a scenario where I call an Sql Database where timeouts are expected due to cold starts. I want to retry in these circumstances, but not anywhere else. I also do not want to litter my orchestration with try...catch, which needs their own workarounds also explained in #2476.

As an example, I have a test activity throwing a TimeoutException and a custom retry handler implemented with TaskOptions.FromRetryHandler:

var taskOptions = TaskOptions.FromRetryHandler(
    async retryContext =>
    {
        // Actual exception in debugger:
        //  TaskFailedException: The operation has timed out.
        //  InnerException: null
        //  FailureDetails: same as retryContext.LastFailure
        
        // retryContext.LastFailure: 
        //  ErrorMessage: "One or more errors occurred. (The operation has timed out.)"
        //  ErrorType: "System.AggregateException"
        //  InnerFailure: null
        
        return false;  // not a useful result
    });

RetryContext contains no useful information. I cannot reliably depend on the error message from an AggregateException.

In this case it it no use to add a try...catch in my orchestration, as the exception thrown is a TaskFailedException with just as little information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Priority 2
Projects
None yet
Development

No branches or pull requests

2 participants