-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RetryPolicy.Handle Property to Allow for Exception Filtering on …
…Retries (#314) Co-authored-by: Tom Seida <[email protected]>
- Loading branch information
Showing
5 changed files
with
247 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
namespace Microsoft.DurableTask.Abstractions; | ||
|
||
/// <summary> | ||
/// Extension methods realated to the global::DurableTask.Core namespace items. | ||
/// </summary> | ||
static class DurableTaskCoreExceptionsExtensions | ||
{ | ||
/// <summary> | ||
/// Converts <paramref name="taskFailedException"/> to a <see cref="TaskFailureDetails"/> instance. | ||
/// If <paramref name="taskFailedException"/> does not contain FailureDetails, null shall be returned. | ||
/// </summary> | ||
/// <param name="taskFailedException"><see cref="global::DurableTask.Core.Exceptions.TaskFailedException"/> instance.</param> | ||
/// <returns> | ||
/// A <see cref="TaskFailureDetails"/> instance if <paramref name="taskFailedException"/> contains | ||
/// FailureDetails; otherwise, null is returned. | ||
/// </returns> | ||
internal static TaskFailureDetails? ToTaskFailureDetails(this global::DurableTask.Core.Exceptions.TaskFailedException taskFailedException) | ||
=> taskFailedException.FailureDetails.ToTaskFailureDetails(); | ||
|
||
/// <summary> | ||
/// Converts <paramref name="subOrchestrationFailedException"/> to a <see cref="TaskFailureDetails"/> instance. | ||
/// If <paramref name="subOrchestrationFailedException"/> does not contain FailureDetails, null shall be returned. | ||
/// </summary> | ||
/// <param name="subOrchestrationFailedException"><see cref="global::DurableTask.Core.Exceptions.SubOrchestrationFailedException"/> instance.</param> | ||
/// <returns> | ||
/// A <see cref="TaskFailureDetails"/> instance if <paramref name="subOrchestrationFailedException"/> contains | ||
/// FailureDetails; otherwise, null is returned. | ||
/// </returns> | ||
internal static TaskFailureDetails? ToTaskFailureDetails(this global::DurableTask.Core.Exceptions.SubOrchestrationFailedException subOrchestrationFailedException) => subOrchestrationFailedException.FailureDetails.ToTaskFailureDetails(); | ||
|
||
/// <summary> | ||
/// Converts <paramref name="failureDetails"/> to a <see cref="TaskFailureDetails"/> instance. | ||
/// </summary> | ||
/// <param name="failureDetails"><see cref="global::DurableTask.Core.FailureDetails"/> instance.</param> | ||
/// <returns> | ||
/// A <see cref="TaskFailureDetails"/> instance if <paramref name="failureDetails"/> is not null; otherwise, null. | ||
/// </returns> | ||
internal static TaskFailureDetails? ToTaskFailureDetails(this global::DurableTask.Core.FailureDetails? failureDetails) | ||
{ | ||
if (failureDetails is null) | ||
{ | ||
return null; | ||
} | ||
|
||
return new TaskFailureDetails( | ||
failureDetails.ErrorType, | ||
failureDetails.ErrorMessage, | ||
failureDetails.StackTrace, | ||
failureDetails.InnerFailure?.ToTaskFailureDetails()); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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