Updated `ExceptionHandlingMiddleware` to enhance error handling: - Added `Microsoft.AspNetCore.Mvc` and `System.Text.Json` for structured JSON responses. - Made `message` nullable to handle cases without explicit messages. - Refactored `ValidationException` handling: - Changed HTTP status code from 422 to 400. - Grouped validation errors by property and returned them in a `ValidationProblemDetails` object. - Conditionally wrote `message` to the response only if not null. - Improved structure and clarity of validation error responses.
ReC
Description
Languages
C#
100%