Пример #1
0
 private async Task InvokeNextExceptionFilterAsync()
 {
     try
     {
         var next        = State.ExceptionNext;
         var state       = (object)null;
         var scope       = Scope.Exception;
         var isCompleted = false;
         while (!isCompleted)
         {
             await Next(ref next, ref scope, ref state, ref isCompleted);
         }
     }
     catch (Exception exception)
     {
         _exceptionContext = new ExceptionContextEx(_controllerContext, exception)
         {
             ExceptionDispatchInfo = ExceptionDispatchInfo.Capture(exception),
         };
     }
 }
Пример #2
0
        private static void Rethrow(ExceptionContextEx context)
        {
            if (context == null)
            {
                return;
            }

            if (context.ExceptionHandled)
            {
                return;
            }

            if (context.ExceptionDispatchInfo != null)
            {
                context.ExceptionDispatchInfo.Throw();
            }

            if (context.Exception != null)
            {
                throw context.Exception;
            }
        }