Beispiel #1
0
        async Task RenderNow(ICommunicationContext context, PipelineStage stage)
        {
            PipelineLog.WriteDebug("Pipeline is in RenderNow mode.");
            if (!stage.ResumeFrom <KnownStages.IOperationResultInvocation>())
            {
                if (stage.OwnerStage != null)
                {
                    PipelineLog.WriteError("Trying to launch nested pipeline to render error failed.");
                    AttemptCatastrophicErrorNotification(context);
                    return;
                }
                using (
                    PipelineLog.Operation(this,
                                          "Rendering contributor has already been executed. Calling a nested pipeline to render the error."))
                {
                    var nestedPipeline = new PipelineStage(this, stage);
                    if (!nestedPipeline.ResumeFrom <KnownStages.IOperationResultInvocation>())
                    {
                        throw new InvalidOperationException("Could not find an IOperationResultInvocation in the new pipeline.");
                    }

                    await RunCallGraph(context, nestedPipeline);
                }
            }
        }
Beispiel #2
0
        protected virtual void AbortPipeline(ICommunicationContext context)
        {
            PipelineLog.WriteError("Aborting the pipeline and rendering the errors.");
            context.OperationResult = new OperationResult.InternalServerError
            {
                Title            = "The request could not be processed because of a fatal error. See log below.",
                ResponseResource = context.ServerErrors
            };
            context.PipelineData.ResponseCodec    = null;
            context.Response.Entity.Instance      = context.ServerErrors;
            context.Response.Entity.Codec         = null;
            context.Response.Entity.ContentLength = null;

            Log.WriteError("An error has occurred and the processing of the request has stopped.\r\n{0}", context.ServerErrors.Aggregate(string.Empty, (str, error) => str + "\r\n" + error.ToString()));
        }