.NET: fix: Expose WorkflowErrorEvent as ErrorContent (#2762)

* fix: Expose WorkflowErrorEvent as ErrorContent

When hosted using .AsAgent(), Workflows were not exposing inner errors coming as Exceptions (through the WorkflowErrorEvent)

The fix is to convert their message to an ErrorContent on the way out, rather than rely on the default "empty update" to collect the raw event.

* feat: Add a way to show/suppress exception information
This commit is contained in:
Jacob Alber
2026-01-08 17:34:05 +00:00
committed by GitHub
parent 7aa72f6fdb
commit 99fac4ca56
5 changed files with 159 additions and 11 deletions
@@ -10,4 +10,10 @@ namespace Microsoft.Agents.AI.Workflows;
/// <param name="e">
/// Optionally, the <see cref="Exception"/> representing the error.
/// </param>
public class WorkflowErrorEvent(Exception? e) : WorkflowEvent(e);
public class WorkflowErrorEvent(Exception? e) : WorkflowEvent(e)
{
/// <summary>
/// Gets the exception that caused the current operation to fail, if one occurred.
/// </summary>
public Exception? Exception => this.Data as Exception;
}