| | | 1 | | namespace NexusLabs.Needlr.AgentFramework.Workflows.Sequential; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Thrown when a pipeline stage exhausts all retry attempts and still fails |
| | | 5 | | /// post-validation. |
| | | 6 | | /// </summary> |
| | | 7 | | /// <example> |
| | | 8 | | /// <code> |
| | | 9 | | /// try |
| | | 10 | | /// { |
| | | 11 | | /// var result = await runner.RunAsync(workspace, stages, options, ct); |
| | | 12 | | /// } |
| | | 13 | | /// catch (StageValidationException ex) |
| | | 14 | | /// { |
| | | 15 | | /// Console.WriteLine($"Stage '{ex.StageName}' failed: {ex.ValidationError}"); |
| | | 16 | | /// } |
| | | 17 | | /// </code> |
| | | 18 | | /// </example> |
| | | 19 | | public sealed class StageValidationException : Exception |
| | | 20 | | { |
| | | 21 | | /// <summary>Gets the name of the stage that failed validation.</summary> |
| | 1 | 22 | | public string StageName { get; } |
| | | 23 | | |
| | | 24 | | /// <summary>Gets the validation error message from the last failed attempt.</summary> |
| | 1 | 25 | | public string ValidationError { get; } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Initializes a new <see cref="StageValidationException"/>. |
| | | 29 | | /// </summary> |
| | | 30 | | /// <param name="stageName">The name of the stage that failed validation.</param> |
| | | 31 | | /// <param name="validationError">The error message from the post-validation function.</param> |
| | | 32 | | public StageValidationException(string stageName, string validationError) |
| | 1 | 33 | | : base($"Stage '{stageName}' failed post-validation: {validationError}") |
| | | 34 | | { |
| | 1 | 35 | | StageName = stageName; |
| | 1 | 36 | | ValidationError = validationError; |
| | 1 | 37 | | } |
| | | 38 | | } |