Skip to content

Commit

Permalink
Ensure ProblemDetails service is registered
Browse files Browse the repository at this point in the history
Modified the AddDefaultExceptionHandler method in the
ServiceCollectionExtensions class to include the
registration of the ProblemDetails service by adding
services.AddProblemDetails().
  • Loading branch information
marcominerva committed Sep 26, 2024
1 parent a8530d7 commit 48c8818
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public static IServiceCollection AddDefaultProblemDetails(this IServiceCollectio
#if NET8_0_OR_GREATER
public static IServiceCollection AddDefaultExceptionHandler(this IServiceCollection services)
{
// Ensures that the ProblemDetails service is registered.
services.AddProblemDetails();

services.AddExceptionHandler<DefaultExceptionHandler>();
return services;
}
Expand Down

0 comments on commit 48c8818

Please sign in to comment.