Exemplo n.º 1
0
 protected virtual async Task<PipelineContinuation> ExecuteContributor(ICommunicationContext context, ContributorCall call)
 {
   using (
     PipelineLog.Operation(this,
       "Executing contributor {0}.{1}".With(call.ContributorTypeName, call.Action.Method.Name)))
   {
     PipelineContinuation nextStep;
     try
     {
       nextStep = await call.Action(context);
     }
     catch (Exception e)
     {
       context.Response.StatusCode = 500;
       context.ServerErrors.Add(new Error
       {
         Title = "Fatal error",
         Message = "An exception was thrown while processing a pipeline contributor",
         Exception = e
       });
       nextStep = PipelineContinuation.Abort;
     }
     return nextStep;
   }
 }
Exemplo n.º 2
0
 bool CanBeExecuted(ContributorCall call)
 {
   if (call.Action != null) return true;
   PipelineLog.WriteWarning("Contributor call for {0} had a null Action.", call.ContributorTypeName);
   return false;
 }
 protected AbstractContributorMiddleware(ContributorCall call)
 {
     ContributorCall   = call;
     ContributorInvoke = call.Action ?? throw new ArgumentNullException(nameof(call.Action));
 }
Exemplo n.º 4
0
 protected virtual PipelineContinuation ExecuteContributor(ICommunicationContext context, ContributorCall call)
 {
     using (PipelineLog.Operation(this, "Executing contributor {0}.{1}".With(call.ContributorTypeName, call.Action.Method.Name)))
     {
         PipelineContinuation nextStep;
         try
         {
             nextStep = call.Action(context);
         }
         catch (Exception e)
         {
             context.Response.StatusCode = 500;
             context.ServerErrors.Add(new Error
             {
                 Title     = "Fatal error",
                 Message   = "An exception was thrown while processing a pipeline contributor",
                 Exception = e
             });
             nextStep = PipelineContinuation.Abort;
         }
         return(nextStep);
     }
 }
 public ResponseMiddleware(ContributorCall call)
     : base(call)
 {
 }