using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Nop.Core.Infrastructure; using Nop.Web.Framework.Infrastructure.Extensions; namespace Nop.Web.Framework.Infrastructure; /// /// Represents object for the configuring exceptions and errors handling on application startup /// public partial class ErrorHandlerStartup : INopStartup { /// /// Add and configure any of the middleware /// /// Collection of service descriptors /// Configuration of the application public void ConfigureServices(IServiceCollection services, IConfiguration configuration) { } /// /// Configure the using of added middleware /// /// Builder for configuring an application's request pipeline public void Configure(IApplicationBuilder application) { //exception handling application.UseNopExceptionHandler(); //handle 400 errors (bad request) application.UseBadRequestResult(); //handle 404 errors (not found) application.UsePageNotFound(); } /// /// Gets order of this startup configuration implementation /// public int Order => 0; //error handlers should be loaded first }