diff --git a/Ginger/GingerCoreCommon/Repository/BusinessFlowLib/ErrorHandler.cs b/Ginger/GingerCoreCommon/Repository/BusinessFlowLib/ErrorHandler.cs index 5c4ccc358b..a6af01718f 100644 --- a/Ginger/GingerCoreCommon/Repository/BusinessFlowLib/ErrorHandler.cs +++ b/Ginger/GingerCoreCommon/Repository/BusinessFlowLib/ErrorHandler.cs @@ -1,4 +1,4 @@ -#region License +#region License /* Copyright © 2014-2024 European Support Limited @@ -69,6 +69,7 @@ public class ErrorHandler : Activity, IErrorHandler { private eHandlerType mHandlerType; public bool IsSelected { get; set; } + public bool IsAddedToReport { get; set; } = false; [IsSerializedForLocalRepository] public eHandlerType HandlerType diff --git a/Ginger/GingerCoreNET/Run/GingerExecutionEngine.cs b/Ginger/GingerCoreNET/Run/GingerExecutionEngine.cs index 49675bb551..1a09394e6a 100644 --- a/Ginger/GingerCoreNET/Run/GingerExecutionEngine.cs +++ b/Ginger/GingerCoreNET/Run/GingerExecutionEngine.cs @@ -3997,7 +3997,7 @@ public void RunActivity(Activity activity, bool doContinueRun = false, bool stan PostScopeVariableHandling(activity.Variables); NotifyActivityEnd(activity); - + CalculateErrorHandlersActivtyEnd(activity); mLastExecutedActivity = activity; CurrentBusinessFlow.PreviousActivity = activity; GiveUserFeedback(); @@ -5863,5 +5863,25 @@ public void ClearBindings() CurrentBusinessFlow.PropertyChanged -= CurrentBusinessFlow_PropertyChanged; } } + + private void CalculateErrorHandlersActivtyEnd(Activity activity) + { + + var errorHandlerList = CurrentBusinessFlow.Activities.Where(x => x.GetType() == typeof(ErrorHandler) && x.Status != eRunStatus.Skipped); + + foreach (ErrorHandler errActivity in errorHandlerList) + { + if ( activity.EndTimeStamp > errActivity.EndTimeStamp && activity.Status == eRunStatus.Failed && !errActivity.IsAddedToReport) + { + uint evetTime = RunListenerBase.GetEventTime(); + foreach (RunListenerBase runnerListener in mRunListeners) + { + runnerListener.ActivityEnd(evetTime, errActivity); + } + errActivity.IsAddedToReport = true; + } + } + + } } }