init
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
|
||||
namespace example_csharp_app;
|
||||
|
||||
public class ErrorLogMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
|
||||
public ErrorLogMiddleware(RequestDelegate next)
|
||||
{
|
||||
_next = next;
|
||||
}
|
||||
|
||||
public async Task Invoke(HttpContext httpContext, IConfiguration configuration)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _next(httpContext);
|
||||
return;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// todo: logme
|
||||
httpContext.Response.StatusCode = 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user