-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValidationException doesn't return the errors only a stacktrace #1085
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When a validation of a api request body fails the thrown exception doesn't give any details on what exactly failed.
To Reproduce
Steps to reproduce the behavior:
Here the failures has 1 item: {Email is required and must be valid.}
The response i get is the following:
HDN_Component_App.Application.Common.Exceptions.ValidationException: One or more validation failures have occurred.
at HDN_Component_App.Application.Common.Behaviours.ValidationBehaviour
2.Handle(TRequest request, RequestHandlerDelegate
1 next, CancellationToken cancellationToken)at HDN_Component_App.Application.Common.Behaviours.AuthorizationBehaviour
2.Handle(TRequest request, RequestHandlerDelegate
1 next, CancellationToken cancellationToken)at HDN_Component_App.Application.Common.Behaviours.UnhandledExceptionBehaviour
2.Handle(TRequest request, RequestHandlerDelegate
1 next, CancellationToken cancellationToken)at HDN_Component_App.Web.Endpoints.Users.CreateUser(ISender sender, CreateUserCommand command) in D:\Projects\HDN-Component-App\Back-End\src\Web\Endpoints\Users.cs:line 34
at Microsoft.AspNetCore.Http.RequestDelegateFactory.g__ExecuteAwaited|121_0(Task`1 task, HttpContext httpContext)
at Microsoft.AspNetCore.Http.RequestDelegateFactory.<>c__DisplayClass94_2.<b__2>d.MoveNext()
--- End of stack trace from previous location ---
at NSwag.AspNetCore.Middlewares.SwaggerUiIndexMiddleware.Invoke(HttpContext context)
at NSwag.AspNetCore.Middlewares.RedirectToIndexMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
HEADERS
Accept: /
Connection: keep-alive
Host: localhost:5001
User-Agent: PostmanRuntime/7.36.0
Accept-Encoding: gzip, deflate, br
Cache-Control: no-cache
Content-Type: application/json
Content-Length: 183
Postman-Token: 921198c3-f13f-40fb-8c9a-b8ceb7cf104d
How do i get it so that the response is the errors not the stacktrace.
The text was updated successfully, but these errors were encountered: