mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Add error handling to workflow samples with agents
Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
This commit is contained in:
committed by
Jacob Alber
co-authored by
lokitoth
parent
bf7056a131
commit
66111a5705
@@ -134,6 +134,18 @@ public static class Program
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ExecutorFailedEvent failureEvent:
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine($"Executor failed [{failureEvent.ExecutorId}]: {failureEvent.Data?.Message ?? "Unknown error"}");
|
||||
Console.ResetColor();
|
||||
break;
|
||||
|
||||
case WorkflowErrorEvent errorEvent:
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine($"Workflow error: {errorEvent.Exception?.Message ?? "Unknown error"}");
|
||||
Console.ResetColor();
|
||||
throw errorEvent.Exception ?? new InvalidOperationException("Workflow encountered an error.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user