-
Notifications
You must be signed in to change notification settings - Fork 372
[Workflow] Add WorkflowTaskFailedException for workflow error handling #1086
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // ------------------------------------------------------------------------ | ||
| // Copyright 2023 The Dapr Authors | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // ------------------------------------------------------------------------ | ||
|
|
||
| namespace Dapr.Workflow | ||
| { | ||
| using System; | ||
|
|
||
| /// <summary> | ||
| /// Exception type for Dapr Workflow task failures. | ||
| /// </summary> | ||
| public class WorkflowTaskFailedException : Exception | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the issue, it seems like this should be inheriting from a type that isn't raw Any reason it's a base Also, this will be a breaking change so we'll have to flag it as such.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is intentionally a breaking change. The TaskFailedException that Marc was trying to catch is actually not something we want to expose publicly since it's defined by the Durable Task Framework, and we're trying to hide those implementation details from the programming model. We solve the problem of leaking Durable types by creating our own exception type ( |
||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="WorkflowTaskFailedException"/> class. | ||
| /// </summary> | ||
| /// <param name="message">The exception message.</param> | ||
| /// <param name="failureDetails">Details about the failure.</param> | ||
| public WorkflowTaskFailedException(string message, WorkflowTaskFailureDetails failureDetails) | ||
| : base(message) | ||
| { | ||
| this.FailureDetails = failureDetails ?? throw new ArgumentNullException(nameof(failureDetails)); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets more information about the underlying workflow task failure. | ||
| /// </summary> | ||
| public WorkflowTaskFailureDetails FailureDetails { get; } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker for this review, but can we include the item that we are trying to purchase here as well as the number of items still available of that type for purchase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, that would have been better. It's actually really difficult to hit this case today since the ReserveInventoryActivity will do this check already before we get here, so I don't think users playing with the sample will ever hit this, but I'll update it if there are other blocking things that need to be done for this PR.