You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/durable/durable-functions-error-handling.md
+99Lines changed: 99 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,9 @@ public static async Task Run(
83
83
> - The exception message typically identifies which activity functions or sub-orchestrations caused the failure. To access more detailed error information, inspect the [`FailureDetails`](/dotnet/api/microsoft.durabletask.taskfailuredetails) property.
84
84
> - By default, `FailureDetails` includes the **error type**, **error message**, **stack trace**, and any **nested inner exceptions** (each represented as a recursive `FailureDetails` object). To include additional exception properties in the failure output, see [Include Custom Exception Properties for FailureDetails (.NET Isolated)](#include-custom-exception-properties-for-failuredetails-net-isolated).
85
85
86
+
> [!IMPORTANT]
87
+
> **Migration note (in-process to isolated):** In the in-process model, `FunctionFailedException.InnerException` contains the original exception object thrown by the activity, which you can cast and inspect directly. In the isolated worker model, `TaskFailedException` does **not** contain the original exception as an `InnerException`. Instead, error details are available only through the [`FailureDetails`](/dotnet/api/microsoft.durabletask.taskfailuredetails) property, which provides string-based properties (`ErrorType`, `ErrorMessage`, `StackTrace`). You can't cast or access the original exception object directly. Use [`FailureDetails.IsCausedBy<T>()`](/dotnet/api/microsoft.durabletask.taskfailuredetails.iscausedby) to check the original exception type.
88
+
86
89
</details>
87
90
<br>
88
91
<details>
@@ -438,6 +441,102 @@ If the **CreditAccount** activity fails, the orchestrator catches the exception
438
441
439
442
::: zone pivot="durable-functions"
440
443
444
+
## Errors with multiple activity calls (fan-out/fan-in)
445
+
446
+
# [C#](#tab/csharp)
447
+
448
+
When you use `Task.WhenAll` to run multiple activity calls in parallel (fan-out/fan-in pattern) and one or more activities fail, `await` throws only the first exception. To access all failures, inspect the `Exception` property on the `Task` returned by `Task.WhenAll`.
449
+
450
+
<details>
451
+
<summary><b>Isolated worker model</b></summary>
452
+
453
+
```csharp
454
+
vartasks=new[]
455
+
{
456
+
context.CallActivityAsync("Activity1", input1),
457
+
context.CallActivityAsync("Activity2", input2),
458
+
context.CallActivityAsync("Activity3", input3),
459
+
};
460
+
461
+
varallTask=Task.WhenAll(tasks);
462
+
try
463
+
{
464
+
awaitallTask;
465
+
}
466
+
catch (TaskFailedException)
467
+
{
468
+
// 'await' rethrows only the first exception. To inspect all failures,
469
+
// check allTask.Exception, which is an AggregateException.
// Use funcFailed.InnerException to access the original exception
514
+
}
515
+
}
516
+
}
517
+
}
518
+
```
519
+
520
+
</details>
521
+
522
+
# [JavaScript](#tab/javascript)
523
+
524
+
In JavaScript, when you use `context.df.Task.all` to run multiple activity calls in parallel, the first failure causes the task to complete with an error. Wrap the call in a try/catch block to handle the error.
525
+
526
+
# [Python](#tab/python)
527
+
528
+
In Python, when you use `context.task_all` to run multiple activity calls in parallel, the first failure causes the task to complete with an error. Wrap the call in a try/except block to handle the error.
529
+
530
+
# [PowerShell](#tab/powershell)
531
+
532
+
In PowerShell, use `Wait-DurableTask` with multiple tasks. If any task fails, the error is raised.
533
+
534
+
# [Java](#tab/java)
535
+
536
+
In Java, when you use `ctx.allOf` to run multiple activity calls in parallel, the first failure causes the task to complete with an error. Use a try/catch block to handle the error.
537
+
538
+
---
539
+
441
540
## Errors in entity functions
442
541
Exception handling in entity functions depends on the Durable Functions hosting model:
0 commit comments