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()); } } }
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()); } }