From 3dd43d0b72c69db7c9d4b9b9678365894f0c8134 Mon Sep 17 00:00:00 2001 From: "Jefferson L. da Silva" Date: Mon, 19 May 2025 10:15:33 -0300 Subject: [PATCH] GlobalExceptionHandler middleware fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrigido filtro de exceção para o status 400 (bad request). --- InvoiceReminder.API/Exceptions/GlobalExceptionHandler.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/InvoiceReminder.API/Exceptions/GlobalExceptionHandler.cs b/InvoiceReminder.API/Exceptions/GlobalExceptionHandler.cs index ba27e18..e8b1f21 100644 --- a/InvoiceReminder.API/Exceptions/GlobalExceptionHandler.cs +++ b/InvoiceReminder.API/Exceptions/GlobalExceptionHandler.cs @@ -20,7 +20,9 @@ public async ValueTask TryHandleAsync(HttpContext httpContext, Exception e httpContext.Response.StatusCode = exception switch { - ApplicationException => StatusCodes.Status400BadRequest, + ArgumentException or + ArgumentNullException or + BadHttpRequestException => StatusCodes.Status400BadRequest, _ => StatusCodes.Status500InternalServerError };