Add OriginalException property to TaskFailureDetails for granular retry logic#539
Closed
Add OriginalException property to TaskFailureDetails for granular retry logic#539
Conversation
Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
| Assert.NotNull(details.OriginalException); | ||
| CustomException? retrievedException = details.OriginalException as CustomException; | ||
| Assert.NotNull(retrievedException); | ||
| Assert.Equal(404, retrievedException.StatusCode); |
| Assert.NotNull(details.OriginalException); | ||
| SqlException? retrievedException = details.OriginalException as SqlException; | ||
| Assert.NotNull(retrievedException); | ||
| Assert.True(retrievedException.IsTransient); |
Comment on lines
+891
to
+900
| if (taskFailureDetails.OriginalException != null) | ||
| { | ||
| // When OriginalException is available (same-process scenarios), | ||
| // users can access specific exception properties | ||
| if (taskFailureDetails.OriginalException is ApiException apiException) | ||
| { | ||
| // Example: Only retry on specific HTTP status codes | ||
| return apiException.StatusCode == 404; | ||
| } | ||
| } |
…ization Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve exception details in retry handling
Add OriginalException property to TaskFailureDetails for granular retry logic
Dec 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
TaskFailureDetailsclass provides type information (ErrorType,ErrorMessage) but not the actual exception object, preventing fine-grained retry decisions based on specific properties like SQL transient error detection or HTTP status codes.Changes
OriginalExceptionproperty toTaskFailureDetails: NullableException?property that preserves the original exception when availableFromException()andToTaskFailureDetails()now preserve exceptions from Core wrappersUsage
Limitations
OriginalExceptionis null whenTaskFailureDetailsis deserialized from storage or received via gRPC, as exceptions aren't serializable. UseIsCausedBy<T>()for type-based decisions in distributed scenarios.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.