private void FillFinalExceptionReportInfo(Exception ex, out StatusReportType finalReportType,
                                                  out StepResult lastStepResult, out FailedInfo failedInfo)
        {
            if (ex is TaskFailedException)
            {
                TaskFailedException failedException = (TaskFailedException)ex;
                FailedType          failedType      = failedException.FailedType;
                this.State      = ModuleUtils.GetRuntimeState(failedType);
                finalReportType = ModuleUtils.GetReportType(failedType);
                lastStepResult  = ModuleUtils.GetStepResult(failedType);
                failedInfo      = new FailedInfo(ex, failedType);
                _context.LogSession.Print(LogLevel.Info, Index, "Step force failed.");
            }
            else if (ex is TestflowAssertException)
            {
                this.State      = RuntimeState.Failed;
                finalReportType = StatusReportType.Failed;
                lastStepResult  = StepResult.Failed;
                failedInfo      = new FailedInfo(ex, FailedType.AssertionFailed);
                _context.LogSession.Print(LogLevel.Error, Index, "Assert exception catched.");
            }
            else if (ex is ThreadAbortException)
            {
                this.State      = RuntimeState.Abort;
                finalReportType = StatusReportType.Error;
                lastStepResult  = StepResult.Abort;
                failedInfo      = new FailedInfo(ex, FailedType.Abort);
                _context.LogSession.Print(LogLevel.Warn, Index, $"Sequence {Index} execution aborted");
            }
            else if (ex is TestflowException)
            {
                this.State      = RuntimeState.Error;
                finalReportType = StatusReportType.Error;
                lastStepResult  = StepResult.Error;
                failedInfo      = new FailedInfo(ex, FailedType.RuntimeError);
                _context.LogSession.Print(LogLevel.Error, Index, ex, "Inner exception catched.");
            }
            else
            {
                this.State      = RuntimeState.Error;
                finalReportType = StatusReportType.Error;
                lastStepResult  = StepResult.Error;
                failedInfo      = new FailedInfo(ex, FailedType.RuntimeError);
                _context.LogSession.Print(LogLevel.Error, Index, ex, "Runtime exception catched.");
            }
//            else if (ex is TargetInvocationException)
//            {
//                this.State = RuntimeState.Failed;
//                finalReportType = StatusReportType.Failed;
//                lastStepResult = StepResult.Failed;
//                failedInfo = new FailedInfo(ex.InnerException, FailedType.TargetError);
//                _context.LogSession.Print(LogLevel.Error, Index, ex, "Invocation exception catched.");
//            }
        }