async Task InvokeSafe(IPipelineMiddleware middleware, ICommunicationContext env)
 {
   try
   {
     await middleware.Invoke(env);
   }
   catch (Exception e)
   {
     env.ServerErrors.Add(new Error {Exception = e});
     env.Abort();
   }
 }
Beispiel #2
0
 async Task InvokeSafe(IPipelineMiddleware middleware, ICommunicationContext env)
 {
     try
     {
         await middleware.Invoke(env);
     }
     catch (Exception e)
     {
         env.ServerErrors.Add(new Error {
             Exception = e
         });
         env.Abort();
     }
 }
        async Task InvokeContributor(ICommunicationContext env)
        {
            try
            {
                env.PipelineData.PipelineStage.CurrentState
                    = await ContributorInvoke(env);
            }
            catch (Exception e) when(_catchExceptions)
            {
                env.Abort(e);
            }
            catch (Exception)
            {
                env.PipelineData["skipToCleanup"] = true;
                await Next.Invoke(env);

                throw;
            }

            await Next.Invoke(env);
        }
        public override async Task Invoke(ICommunicationContext env)
        {
            var currentState = env.PipelineData.PipelineStage.CurrentState;

            if (currentState != PipelineContinuation.Continue)
            {
                await Next.Invoke(env);

                return;
            }

            try
            {
                env.PipelineData.PipelineStage.CurrentState
                    = await ContributorInvoke(env);
            }
            catch (Exception e)
            {
                env.Abort(e);
            }
            await Next.Invoke(env);
        }
        public override async Task Invoke(ICommunicationContext env)
        {
            if (env.PipelineData.TryGetValue("skipToCleanup", out var isSkip) && isSkip is bool skip && skip)
            {
                await Next.Invoke(env);

                return;
            }

            var currentState = env.PipelineData.PipelineStage.CurrentState;

            if (currentState != PipelineContinuation.Continue)
            {
                await Next.Invoke(env);

                return;
            }

            try
            {
                env.PipelineData.PipelineStage.CurrentState
                    = await ContributorInvoke(env);
            }
            catch (Exception e) when(_catchExceptions)
            {
                env.Abort(e);
            }
            catch (Exception)
            {
                env.PipelineData["skipToCleanup"] = true;
                await Next.Invoke(env);

                throw;
            }

            await Next.Invoke(env);
        }