fix: return exception message if controller exception

This commit is contained in:
Polianin Nikita 2024-12-28 06:47:21 +03:00
parent 07111b9b61
commit 61a11ea223

View File

@ -65,6 +65,7 @@ public class CustomExceptionHandlerMiddleware(RequestDelegate next, ILogger<Cust
problemDetails.Status = StatusCodes.Status400BadRequest; problemDetails.Status = StatusCodes.Status400BadRequest;
problemDetails.Type = "https://tools.ietf.org/html/rfc9110#section-15.5.1"; problemDetails.Type = "https://tools.ietf.org/html/rfc9110#section-15.5.1";
problemDetails.Title = "Invalid arguments provided."; problemDetails.Title = "Invalid arguments provided.";
problemDetails.Detail = exception.Message;
break; break;
case SecurityException: case SecurityException:
problemDetails.Status = StatusCodes.Status401Unauthorized; problemDetails.Status = StatusCodes.Status401Unauthorized;