X Tutup
Skip to content

Include Exception Properties at FailureDetails#263

Open
nytian wants to merge 5 commits intomainfrom
nytian/failuredetails
Open

Include Exception Properties at FailureDetails#263
nytian wants to merge 5 commits intomainfrom
nytian/failuredetails

Conversation

@nytian
Copy link

@nytian nytian commented Feb 23, 2026

Adds support for inner failure details and custom exception properties in the Java SDK, matching the .NET SDK implementation (durabletask-dotnet#474, azure-functions-durable-extension#3215).

  • Add innerFailure and properties fields to FailureDetails, with full protobuf round-trip support
  • Add ExceptionPropertiesProvider interface for custom property extraction via the worker builder
  • Recursively capture inner exception chains from Throwable.getCause()
  • Add unit tests and integration tests for the new functionality
  • Backward compatible — existing users who don't register a provider see no behavior change.

@nytian nytian requested a review from a team as a code owner February 23, 2026 18:08
Copilot AI review requested due to automatic review settings February 23, 2026 18:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for exception properties and inner failure details to the FailureDetails class, allowing richer error information to be captured and propagated through the Durable Task framework. The PR also includes a protobuf file sync from the upstream repository, which introduces many additional protocol buffer changes beyond the core feature.

Changes:

  • Added properties field to TaskFailureDetails protobuf message to store exception metadata
  • Added innerFailure field support to capture exception cause chains
  • Implemented bidirectional conversion between protobuf Value types and Java objects
  • Added comprehensive unit tests covering properties, inner failures, and round-trip serialization
  • Updated DurableTaskGrpcWorker to use the new FailureDetails constructor for consistent exception handling
  • Synced protobuf definitions from upstream repository (commit hash 1caadbd7ecfdf5f2309acbeac28a3e36d16aa156)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/durabletask-protobuf/protos/orchestrator_service.proto Added properties field to TaskFailureDetails; synced many other protobuf changes from upstream
internal/durabletask-protobuf/PROTO_SOURCE_COMMIT_HASH Updated to track new protobuf source commit
client/src/main/java/com/microsoft/durabletask/FailureDetails.java Added properties and innerFailure fields with conversion methods; added toString() override
client/src/test/java/com/microsoft/durabletask/FailureDetailsTest.java Comprehensive new test file covering all aspects of the new functionality
client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcWorker.java Refactored to use FailureDetails constructor instead of building proto directly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1 +1 @@
fbe5bb20835678099fc51a44993ed9b045dee5a6 No newline at end of file
1caadbd7ecfdf5f2309acbeac28a3e36d16aa156 No newline at end of file
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description contains placeholder text "resolves #issue_for_this_pr" instead of an actual issue number. The checklist also indicates that changes should be added to CHANGELOG.md, but no changes to CHANGELOG.md are included in this PR. Please update the PR description with the actual issue number and add an entry to the "Unreleased" section of CHANGELOG.md documenting this feature addition.

Copilot uses AI. Check for mistakes.
Comment on lines 150 to 161
public boolean isCausedBy(Class<? extends Exception> exceptionClass) {
String actualClassName = this.getErrorType();
try {
// Try using reflection to load the failure's class type and see if it's a subtype of the specified
// exception. For example, this should always succeed if exceptionClass is System.Exception.
Class<?> actualExceptionClass = Class.forName(actualClassName);
return exceptionClass.isAssignableFrom(actualExceptionClass);
} catch (ClassNotFoundException ex) {
// Can't load the class and thus can't tell if it's related
return false;
}
}
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new innerFailure field is not tested with the isCausedBy method. It's unclear whether isCausedBy should only check the current failure or should traverse the innerFailure chain (similar to how one might need to check both an exception and its causes). Consider adding tests to clarify and document this behavior, or update the isCausedBy method to traverse the chain if that's the intended behavior.

Copilot uses AI. Check for mistakes.
* @return an unmodifiable map of property names to values, or {@code null}
*/
@Nullable
public Map<String, Object> getProperties() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup