コード例 #1
0
        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;
            };
        }
コード例 #2
0
        public CoercingPipelines()
        {
            AfterRequest = new AfterPipeline();
            BeforeRequest = new BeforePipeline();
            OnError = new ErrorPipeline();

            OnError += (ctx, ex) => ctx.Response;
        }
コード例 #3
0
ファイル: NancyEngine.cs プロジェクト: uliian/Nancy
 private Task InvokePostRequestHook(NancyContext context, CancellationToken cancellationToken, AfterPipeline pipeline)
 {
     return pipeline == null ? TaskHelpers.CompletedTask : pipeline.Invoke(context, cancellationToken);
 }
コード例 #4
0
ファイル: NancyEngine.cs プロジェクト: drunkirishcoder/Nancy
 private Task InvokePostRequestHook(NancyContext context, CancellationToken cancellationToken, AfterPipeline pipeline)
 {
     return(pipeline.Invoke(context, cancellationToken));
 }
コード例 #5
0
ファイル: NancyEngine.cs プロジェクト: zhamppx97/sonar-dotnet
 private Task InvokePostRequestHook(NancyContext context, CancellationToken cancellationToken, AfterPipeline pipeline)
 {
     return(pipeline == null ? TaskHelpers.CompletedTask : pipeline.Invoke(context, cancellationToken));
 }
コード例 #6
0
ファイル: NancyEngine.cs プロジェクト: leoduran/Nancy
 private Task InvokePostRequestHook(NancyContext context, CancellationToken cancellationToken, AfterPipeline pipeline)
 {
     return pipeline.Invoke(context, cancellationToken);
 }