Esempio n. 1
0
        private void PerformTaskTeardown(ICakeContext context, IExecutionStrategy strategy, ICakeTaskInfo task, TimeSpan duration, bool skipped, Exception taskException)
        {
            var exceptionWasThrown = taskException != null;

            var taskTeardownContext = new TaskTeardownContext(context, task, duration, skipped, taskException);

            PublishEvent(TaskTeardown, new TaskTeardownEventArgs(taskTeardownContext));
            if (_actions.TaskTeardown != null)
            {
                try
                {
                    strategy.PerformTaskTeardown(_actions.TaskTeardown, taskTeardownContext);
                }
                catch (Exception ex)
                {
                    _log.Error("An error occurred in the custom task teardown action ({0}).", task.Name);
                    if (!exceptionWasThrown)
                    {
                        // If no other exception was thrown, we throw this one.
                        throw;
                    }

                    _log.Error("Task Teardown error ({0}): {1}", task.Name, ex.ToString());
                }
            }
        }
Esempio n. 2
0
        private void PerformTaskTeardown(ICakeContext context, IExecutionStrategy strategy, ICakeTaskInfo task, TimeSpan duration, bool skipped, bool exceptionWasThrown)
        {
            if (TaskTeardownAction == null)
            {
                return;
            }

            var taskTeardownContext = new TaskTeardownContext(task, duration, skipped);

            try
            {
                strategy.PerformTaskTeardown(TaskTeardownAction, context, taskTeardownContext);
            }
            catch (Exception ex)
            {
                _log.Error("An error occured in the custom task teardown action ({0}).", task.Name);
                if (!exceptionWasThrown)
                {
                    // If no other exception was thrown, we throw this one.
                    throw;
                }
                _log.Error("Task Teardown error ({0}): {1}", task.Name, ex.ToString());
            }
        }
Esempio n. 3
0
        public void PerformTaskTeardown(ICakeContext context, IExecutionStrategy strategy, CakeTask task, TimeSpan duration, bool skipped, bool exceptionWasThrown)
        {
            var taskTeardownContext = new TaskTeardownContext(context, task, duration, skipped);

            PublishEvent(TaskTeardown, new TaskTeardownEventArgs(taskTeardownContext));

            if (_taskTeardownAction != null)
            {
                try
                {
                    strategy.PerformTaskTeardown(_taskTeardownAction, taskTeardownContext);
                }
                catch (Exception ex)
                {
                    _log.Error($"An error occurred in the custom task teardown action ({task.Name}).");
                    if (!exceptionWasThrown)
                    {
                        // If no other exception was thrown, we throw this one.
                        throw;
                    }
                    _log.Error($"Task Teardown error ({task.Name}): {ex}");
                }
            }
        }
 /// <summary>
 /// Performs the specified teardown action after each task is invoked.
 /// </summary>
 /// <param name="action">The action.</param>
 /// <param name="taskTeardownContext">The context.</param>
 public void PerformTaskTeardown(Action <ITaskTeardownContext> action, ITaskTeardownContext taskTeardownContext)
 {
     _default.PerformTaskTeardown(action, taskTeardownContext);
 }