public ErrorHandlingPipelines(IResponseNegotiator responseNegotiator, INancyErrorMap errorMap) { this.responseNegotiator = responseNegotiator; this.errorMap = errorMap; AfterRequest = new AfterPipeline(); BeforeRequest = new BeforePipeline(); OnError = new ErrorPipeline(); OnError += (ctx, ex) => { var nonAggregateException = ex.TrimAggregateException(); if (!errorMap.Contains(nonAggregateException.GetType())) { Logger.DebugFormat("Exception type not found in ErrorMap. Exception: {0}", nonAggregateException.GetType()); ctx.Response = DefaultError(ctx); } else { ctx.Response = Error(nonAggregateException, ctx); } return null; }; }
public CoercingPipelines() { AfterRequest = new AfterPipeline(); BeforeRequest = new BeforePipeline(); OnError = new ErrorPipeline(); OnError += (ctx, ex) => ctx.Response; }
private Task InvokePostRequestHook(NancyContext context, CancellationToken cancellationToken, AfterPipeline pipeline) { return pipeline == null ? TaskHelpers.CompletedTask : pipeline.Invoke(context, cancellationToken); }
private Task InvokePostRequestHook(NancyContext context, CancellationToken cancellationToken, AfterPipeline pipeline) { return(pipeline.Invoke(context, cancellationToken)); }
private Task InvokePostRequestHook(NancyContext context, CancellationToken cancellationToken, AfterPipeline pipeline) { return(pipeline == null ? TaskHelpers.CompletedTask : pipeline.Invoke(context, cancellationToken)); }
private Task InvokePostRequestHook(NancyContext context, CancellationToken cancellationToken, AfterPipeline pipeline) { return pipeline.Invoke(context, cancellationToken); }