Repository navigation
Add FailureDetailsProvider E2E Test for Node #3463
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
Merged
Naiyuan Tian (nytian)
merged 16 commits into
dev
from
nytian/js-e2e-test-failure-details
Oct 20, 2026
Merged
Changes from 6 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8f9def2
add js test for failuredetails provider
nytian 23f7741
Merge branch 'dev' into nytian/js-e2e-test-failure-details
nytian 14871ee
Merge branch 'dev' into nytian/js-e2e-test-failure-details
nytian d2e1943
Update durable-functions to 3.5.0
nytian 3df0b25
update azuremanaged sdk ver
nytian fe478c3
Merge branch 'dev' into nytian/js-e2e-test-failure-details
nytian 58d49aa
Merge branch 'dev' into nytian/js-e2e-test-failure-details
nytian f184948
Merge branch 'dev' into nytian/js-e2e-test-failure-details
nytian d20a1d6
update e2e node sql msg
nytian afb92f9
Merge branch 'nytian/js-e2e-test-failure-details' of https://github.c…
nytian 3eb41a7
Merge branch 'dev' into nytian/js-e2e-test-failure-details
nytian f370d4c
merge latest from dev
nytian ecde747
update to v3.6.
nytian ed31978
Merge branch 'nytian/js-e2e-test-failure-details' of https://github.c…
nytian 27dfc68
fix tests
nytian 5efb1d3
Remove redundant Node MSSQL error message special case
nytian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
101 changes: 101 additions & 0 deletions
101
test/e2e/Apps/BasicNode/src/functions/CustomExceptionProperties.ts
This file contains hidden or 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,101 @@ | ||
| // Copyright (c) .NET Foundation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
|
||
| import * as df from 'durable-functions'; | ||
| import { | ||
| ActivityHandler, | ||
| ExceptionPropertiesProvider, | ||
| OrchestrationContext, | ||
| OrchestrationHandler, | ||
| TaskFailedError, | ||
| } from 'durable-functions'; | ||
| import { BusinessValidationException } from '../Shared/ExceptionTypes'; | ||
|
|
||
| // Register a global provider that surfaces custom properties from thrown | ||
| // exceptions into FailureDetails.Properties. Mirrors the .NET isolated | ||
| // TestExceptionPropertiesProvider used by BasicDotNetIsolated. | ||
| const provider: ExceptionPropertiesProvider = { | ||
| getExceptionProperties(error: unknown): Record<string, unknown> | undefined { | ||
| if (error instanceof BusinessValidationException) { | ||
| return { | ||
| StringProperty: error.stringProperty, | ||
| IntProperty: error.intProperty, | ||
| LongProperty: error.longProperty, | ||
| DateTimeProperty: error.dateTimeProperty, | ||
| DictionaryProperty: error.dictionaryProperty, | ||
| ListProperty: error.listProperty, | ||
| NullProperty: error.nullProperty, | ||
| }; | ||
| } | ||
| return undefined; | ||
| }, | ||
| }; | ||
| df.app.setExceptionPropertiesProvider(provider); | ||
|
|
||
| // Activity: BusinessActivity - throws an exception carrying custom properties. | ||
| const BusinessActivity: ActivityHandler = (): void => { | ||
| throw new BusinessValidationException( | ||
| "Business logic validation failed", | ||
| "validation-error-123", | ||
| 100, | ||
| 999999999, | ||
| "2025-10-15T14:30:00.000Z", | ||
| { | ||
| error_code: "VALIDATION_FAILED", | ||
| retry_count: 3, | ||
| is_critical: true, | ||
| }, | ||
| ["error1", "error2", 500, null], | ||
| null | ||
| ); | ||
| }; | ||
| df.app.activity("BusinessActivity", { handler: BusinessActivity }); | ||
|
|
||
| // Sub-orchestration: calls the activity and lets the failure (with its | ||
| // structured FailureDetails) propagate out so a parent can observe it. Used by | ||
| // the nested scenario below. | ||
| const BusinessSubOrchestration: OrchestrationHandler = function* (context: OrchestrationContext) { | ||
| yield context.df.callActivity("BusinessActivity"); | ||
| }; | ||
| df.app.orchestration("BusinessSubOrchestration", BusinessSubOrchestration); | ||
|
|
||
| // Parent orchestration: calls the activity directly, catches the propagated | ||
| // TaskFailedError, and returns its FailureDetails. This mirrors the .NET | ||
| // isolated OrchestrationWithCustomException reference so the custom-exception- | ||
| // properties feature is validated for Node exactly as it works for dotnet | ||
| // isolated. | ||
| const OrchestrationWithCustomException: OrchestrationHandler = function* (context: OrchestrationContext) { | ||
| try { | ||
| yield context.df.callActivity("BusinessActivity"); | ||
| } catch (e: unknown) { | ||
| if (e instanceof TaskFailedError) { | ||
| return e.failureDetails; | ||
| } | ||
| throw e; | ||
| } | ||
|
|
||
| // Should never reach here. | ||
| return null; | ||
| }; | ||
| df.app.orchestration("OrchestrationWithCustomException", OrchestrationWithCustomException); | ||
|
|
||
| // Nested scenario: parent orchestration that calls a sub-orchestration (which | ||
| // in turn calls the failing activity), catches the propagated TaskFailedError, | ||
| // and returns its FailureDetails — exercising FailureDetails propagation across | ||
| // a sub-orchestration boundary. | ||
| const NestedOrchestrationWithCustomException: OrchestrationHandler = function* ( | ||
| context: OrchestrationContext | ||
| ) { | ||
| try { | ||
| yield context.df.callSubOrchestrator("BusinessSubOrchestration"); | ||
| } catch (e: unknown) { | ||
| if (e instanceof TaskFailedError) { | ||
| return e.failureDetails; | ||
| } | ||
| throw e; | ||
| } | ||
|
|
||
| // Should never reach here. | ||
| return null; | ||
| }; | ||
| df.app.orchestration("NestedOrchestrationWithCustomException", NestedOrchestrationWithCustomException); |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.