Example #1
0
        public DeveloperExceptionPageMiddleware(DeveloperExceptionPageOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _options = options;
        }
        /// <summary>
        /// Captures <see cref="Exception"/> instances from the pipeline and generates error responses.
        /// </summary>
        /// <param name="app">The <see cref="ServerOptions"/> instance this method extends.</param>
        /// <param name="options">The <see cref="DeveloperExceptionPageOptions"/> used to configure the middleware.</param>
        public static void UseDeveloperExceptionPage(this ServerOptions app, DeveloperExceptionPageOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            app.UseMiddleware(new DeveloperExceptionPageMiddleware(options));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DeveloperExceptionPageMiddleware"/> class.
        /// </summary>
        /// <param name="loggerFactory">The factory used to create loggers.</param>
        /// <param name="options">The options for configuring the middleware.</param>
        public DeveloperExceptionPageMiddleware(ILoggerFactory loggerFactory, DeveloperExceptionPageOptions options)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _logger  = loggerFactory.CreateLogger("Bytewizer.TinyCLR.Http");
            _options = options;
        }
Example #4
0
 public DeveloperExceptionPageMiddleware()
 {
     _options = new DeveloperExceptionPageOptions();
 }
Example #5
0
        /// <summary>
        /// Captures <see cref="Exception"/> instances from the pipeline and generates error responses.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> instance this method extends.</param>
        /// <param name="options">The <see cref="DeveloperExceptionPageOptions"/> used to configure the middleware.</param>
        public static IApplicationBuilder UseDeveloperExceptionPage(this IApplicationBuilder app, DeveloperExceptionPageOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(app.UseMiddleware(typeof(DeveloperExceptionPageMiddleware), options));
        }