Skip to content

Commit 33d017f

Browse files
authored
Merge pull request #333 from nanotaboada/fix/exception-middleware-constructor
fix: add RequestDelegate to ExceptionMiddleware constructor
2 parents cff7431 + 526e4cb commit 33d017f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Dotnet.Samples.AspNetCore.WebApi/Middlewares/ExceptionMiddleware.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ namespace Dotnet.Samples.AspNetCore.WebApi.Middlewares;
88
/// <summary>
99
/// Middleware for global exception handling with RFC 7807 Problem Details format.
1010
/// </summary>
11-
public class ExceptionMiddleware(ILogger<ExceptionMiddleware> logger, IHostEnvironment environment)
11+
public class ExceptionMiddleware(
12+
RequestDelegate next,
13+
ILogger<ExceptionMiddleware> logger,
14+
IHostEnvironment environment
15+
)
1216
{
1317
private const string ProblemDetailsContentType = "application/problem+json";
1418

@@ -18,7 +22,7 @@ public class ExceptionMiddleware(ILogger<ExceptionMiddleware> logger, IHostEnvir
1822
/// <summary>
1923
/// Invokes the middleware to handle exceptions globally.
2024
/// </summary>
21-
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
25+
public async Task InvokeAsync(HttpContext context)
2226
{
2327
try
2428
{

0 commit comments

Comments
 (0)