Files
pdf-service/PdfService/ExceptionHandlerMiddleware.cs

24 lines
451 B
C#

namespace PdfService;
public class ExceptionHandlerMiddleware
{
private readonly RequestDelegate _next;
public ExceptionHandlerMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task InvokeAsync(HttpContext context)
{
try
{
await _next(context);
}
catch (Exception ex)
{
SentrySdk.CaptureException(ex);
throw;
}
}
}