Esempio n. 1
0
 internal static bool TryWrap(Exception exception, out Exception result)
 {
     if (exception is ScenarioExecutionException || exception is StepExecutionException)
     {
         result = exception;
         return(false);
     }
     result = new ScenarioExecutionException(exception);
     return(true);
 }
Esempio n. 2
0
            /// <summary>
            /// Returns waits for task to finish and throws <see cref="ScenarioExecutionException"/> if task failed.
            /// </summary>
            public void GetResult()
            {
                if (!_task.IsCompleted)
                {
                    _task.Wait();
                }

                if (_task.Exception != null)
                {
                    if (ScenarioExecutionException.TryWrap(_task.Exception.InnerExceptions[0], out var exception))
                    {
                        throw exception;
                    }
                    ExceptionDispatchInfo.Capture(exception).Throw();
                }
                _awaiter.GetResult();
            }