Feature: Activity Error/Fault Handling
See original GitHub issueHi @sfmskywalker,
Has any thought been put into handling errors/faults?
Could the “ActivityBase” class define a outcome of “Faulted” as standard, or change the below to always add OutcomeNames.Fault to the list.
public static ActivityDescriptor Describe(Type activityType)
{
var activityDefinitionAttribute = activityType.GetCustomAttribute<ActivityDefinitionAttribute>();
var typeName = activityDefinitionAttribute?.Type ?? activityType.Name;
var displayName =
activityDefinitionAttribute?.DisplayName ??
activityType.Name.Humanize(LetterCasing.Title);
var description = activityDefinitionAttribute?.Description;
var runtimeDescription = activityDefinitionAttribute?.RuntimeDescription;
var category = activityDefinitionAttribute?.Category ?? "Miscellaneous";
var icon = activityDefinitionAttribute?.Icon;
var outcomes = activityDefinitionAttribute?.Outcomes ?? new[] { OutcomeNames.Done };
//Insert OutcomeNames.Faulted into the list here
var properties = DescribeProperties(activityType);
return new ActivityDescriptor
{
Type = typeName.Pascalize(),
DisplayName = displayName,
Description = description,
RuntimeDescription = runtimeDescription,
Category = category,
Icon = icon,
Properties = properties.ToArray(),
Outcomes = outcomes
};
}
If execution faulted, and the workflow has a connection for the “Faulted” outcome, follow its path to another activity and schedule it. If there is no connection, just fault the workflow as normal.
The next activity could just go back some steps and try the set of steps again (it could also do this a set number of times), or it could do a rollback to perform a clean up, then exit as faulted.
It could even point back to itself, to perform a retry with a TimedEvent activity.
Hopefully the above makes sense to you.
Thanks
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:13 (7 by maintainers)
Top Results From Across the Web
8 Fault Handling
The catch activity works within a scope to catch faults and exceptions before they can throw the entire process into a faulted state....
Read more >9 Fault Handling
The catch activity works within a scope to catch faults and exceptions before they can throw the entire process into a faulted state....
Read more >Foundations - Error Handling In Workflows
To handle a fault, the first step is to define a scope of execution. In .NET code, this is accomplished with the try...
Read more >Handle errors in ASP.NET Core
This exception handling middleware: Catches and logs unhandled exceptions. Re-executes the request in an alternate pipeline using the path ...
Read more >Fault Handlers
Fault handlers allow you to catch faults or exceptions and create fault-handling procedures to deal with potential runtime errors in your process definitions....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That is well justified for specifically stating it can Fault rather than always. Alternatively, the IActivity interface could have a boolean “CanFault” property that can be used for that purpose. If true, automatically add the Faulted outcome.
Love the sound of that.
Love this also, and makes the activity more configurable for different scenarios of transient errors.
This would be great for grouping activities that need to be executed together after a failure and then retrying. If will also be more visually pleasant and easier to understand if the designer houses them in a container too.
I agree, let’s not have a general Try/Catch activity to catch any and all exceptions, but instead let individual activities decide what to handle and how to expose outcomes (the HTTP Request activity is a great example).