From d472ed2ae705951938ee57efdaa49352ed82fbe2 Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Wed, 18 Mar 2026 15:10:38 -0700 Subject: [PATCH] Improvements to error handling. --- .../BuiltInFunctions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs index 3420c56512..e6c94347a1 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs @@ -416,7 +416,8 @@ internal static class BuiltInFunctions if (metadata.RuntimeStatus is OrchestrationRuntimeStatus.Failed) { - throw new InvalidOperationException($"Workflow orchestration '{instanceId}' failed: {metadata.ReadOutputAs()}"); + string errorMessage = metadata.FailureDetails?.ErrorMessage ?? "Unknown error"; + throw new InvalidOperationException($"Workflow orchestration '{instanceId}' failed: {errorMessage}"); } if (metadata.RuntimeStatus is not OrchestrationRuntimeStatus.Completed)