Refactor ExceptionHandlingMiddleware and update dependencies
Rewrote the `ExceptionHandlingMiddleware` class to improve structure and functionality, changing its namespace to `DigitalData.Core.Exceptions`. Updated the constructor to support a nullable logger and implemented null-conditional logging for unhandled exceptions. Added new package references in `DigitalData.Core.Exceptions.csproj` for `Microsoft.AspNetCore.Http.Abstractions` and `Microsoft.Extensions.Logging.Abstractions`. Introduced a new `DependencyInjection` class to register the middleware in the application's pipeline.
This commit is contained in:
12
DigitalData.Core.Exceptions/DependencyInjection.cs
Normal file
12
DigitalData.Core.Exceptions/DependencyInjection.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
|
||||
namespace DigitalData.Core.Exceptions;
|
||||
|
||||
public static class DependencyInjection
|
||||
{
|
||||
public static IApplicationBuilder UseExceptionHandlingMiddleware(this IApplicationBuilder app)
|
||||
{
|
||||
app.UseMiddleware<ExceptionHandlingMiddleware>();
|
||||
return app;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user