-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add support of task failures #1
Comments
Yeah, maybe give the ability to defyn a delegate to handle a failed task? |
I think that the task should handle all exceptions it can handle, all the rest must notify the user so that the user can take action and re-run one or all the failed tests. The task runner should do this thing: try
{
task.Action.Invoke();
return new TaskResult(TaskResultType.Passed);
}
catch (ThreadAbortException)
{
return new TaskResult(TaskResultType.Aborted);
}
catch (Exception ex)
{
return new TaskResult(TaskResultType.Failed, ex);
} and it should have API like: var tc = new TaskContainer();
...
tc.OnTaskFault += (task, ex) => Console.WriteLine("The {0} task failed. {1}", task.Name, ex.Message);
var result = tc.Run();
while (result.HasErrors)
{
var failedTasks = result.FailedTasks; // failed tasks and the exceptions
var reRunMode = AskUserAboutReRunMode(failedTasks);
if(ReRunMode.All == reRunMode)
{
result = tc.ReRun();
}
else if(ReRunMode.SelectedTasks == reRunMode)
{
var tasksToReRun = AskUserWhichTasksToReRun(failedTasks);
result = tc.ReRun(tasksToReRun);
}
} |
I dont think we should handle the exception as this should be the responsibility of the class using the API. Have done some playing with the code, see the new SimpleTasks.Play project for an idea of what I am thinking of. I will implement the suggestions you have suggested also at some point so we can weigh up the options between the two. |
Need to have the ability to know what tasks completed and what tasks could not run. The tasks that could not run should also include dependants of these tasks as they also should not have executed. |
Currently, if one of the tasks fails with unhandled exception, the entire system fails with this exception. We need to make the system more stable by adding failure control functionality.
The text was updated successfully, but these errors were encountered: