Uh oh!
There was an error while loading. Please reload this page.
Add ExceptionPropertiesSample demonstrating IExceptionPropertiesProvi… - #560
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new sample demonstrating the usage of IExceptionPropertiesProvider to enrich TaskFailureDetails with custom exception properties. The sample shows how to create custom exceptions with additional diagnostic information and how to configure the Durable Task framework to automatically extract and include these properties in failure details.
Key Changes
- Adds a complete standalone sample showing IExceptionPropertiesProvider usage
- Demonstrates custom business validation exceptions with error codes, status codes, and metadata
- Shows how to register and use the provider with the Durable Task worker
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| samples/ExceptionPropertiesSample/Tasks.cs | Defines orchestration and activity that demonstrate throwing custom exceptions |
| samples/ExceptionPropertiesSample/README.md | Comprehensive documentation explaining the sample's purpose, structure, and usage |
| samples/ExceptionPropertiesSample/Program.cs | Main entry point that configures the worker, registers the provider, and runs test cases |
| samples/ExceptionPropertiesSample/ExceptionPropertiesSample.csproj | Project configuration following standard sample patterns |
| samples/ExceptionPropertiesSample/CustomExceptions.cs | Custom BusinessValidationException with additional diagnostic properties |
| samples/ExceptionPropertiesSample/CustomExceptionPropertiesProvider.cs | Implementation of IExceptionPropertiesProvider that extracts custom properties from exceptions |
Comments suppressed due to low confidence (1)
samples/ExceptionPropertiesSample/Tasks.cs:22
- This assignment to ex is useless, since its value is never read.
catch (TaskFailedException ex)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…ariable' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…microsoft/durabletask-dotnet into add-exception-properties-sample
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This pull request adds a new sample,
ExceptionPropertiesSample, to demonstrate how to enrichTaskFailureDetailswith custom exception properties using theIExceptionPropertiesProviderinterface in Durable Task. The sample includes custom exception types, a provider for extracting properties, orchestration and activity implementations, and documentation.New Exception Properties Sample
Sample project and solution integration:
ExceptionPropertiesSamplewith supporting files, and integrated it into the solution (Microsoft.DurableTask.sln). This includes build configuration and project references for both local and DTS scenarios. [1][2][3][4]Custom exception enrichment:
BusinessValidationExceptionwith additional properties (ErrorCode,StatusCode,Metadata) for richer error diagnostics.CustomExceptionPropertiesProviderthat implementsIExceptionPropertiesProviderto extract custom properties from specific exception types and include them in orchestration failure details.Sample orchestration and activity:
ValidationOrchestrationandValidateInputActivityto simulate input validation and throw custom exceptions with enriched properties on failure.Sample usage and demonstration:
Program.csto set up the worker, register the custom exception properties provider, and run test cases to show how enriched failure details are retrieved and displayed.Documentation:
README.mdexplaining the sample's purpose, setup, usage, and expected output, with code snippets and notes for users.AI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):