示例#1
0
        public static IApplicationBuilder UseJsonException(this IApplicationBuilder app, ExceptionMiddlewareConfig config = null)
        {
            if (config == null)
            {
                config = new ExceptionMiddlewareConfig();
            }

            app.UseMiddleware <JsonExceptionMiddleware>(config);
            return(app);
        }
示例#2
0
 public JsonExceptionMiddleware(RequestDelegate next, ILogger <JsonExceptionMiddleware> log, ExceptionMiddlewareConfig config)
 {
     _next             = next;
     _log              = log;
     _isDetailsEnabled = config.EnableDetails;
 }
示例#3
0
 public JsonExceptionMiddleware(RequestDelegate next, ILogger <JsonExceptionMiddleware> log, ExceptionMiddlewareConfig config)
 {
     _next             = next;
     _log              = log;
     _isDetailsEnabled = config.EnableDetails;
     _contractResolver = config.ContractResolver ?? new DefaultContractResolver();
 }