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:
Developer 02
2025-05-16 15:55:27 +02:00
parent eae0d9f913
commit f93b197d45
3 changed files with 22 additions and 6 deletions

View 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;
}
}