Add error handling to workflow samples with agents

Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-17 10:50:02 -05:00
committed by Jacob Alber
co-authored by lokitoth
parent bf7056a131
commit 66111a5705
9 changed files with 163 additions and 53 deletions
@@ -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.");
}
}