Skip to content
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

Return HTTP 500 instead of 400 on ValidationException (#254) #260

Merged

Conversation

jburkal
Copy link
Contributor

@jburkal jburkal commented Jan 22, 2023

Fixes #254 by having ValidationExceptionMapper return a HttpProblem with INTERNAL_SERVER_ERROR instead of BAD_REQUEST.

I tried deleting the ValidationExceptionMapper in the hope that the exception would then be handled by the DefaultExceptionMapper, but that didn't work as it was instead handled by the exception mapper from Quarkus.

Also adds an additional integration-test, checking that a HTTP 500 is returned if a subclass of ValidationException is thrown, and renames ValidationExceptionsResource to fix a typo.

The branch passes both run-jvm-tests and run-native-tests, but fails when running ./mvnw verify with an exception:

java.lang.IllegalStateException: The current thread cannot be blocked: vert.x-eventloop-thread-0

However, as the master branch fails with the same exception on my machine, I assume it's unrelated to the changes made in this branch.

@jburkal
Copy link
Contributor Author

jburkal commented Jan 22, 2023

After merging this, the documentation at https://github.com/tietoevry/quarkus-resteasy-problem/wiki#javaxvalidationvalidationexception should be updated.

@lwitkowski
Copy link
Collaborator

I tried deleting the ValidationExceptionMapper in the hope that the exception would then be handled by the DefaultExceptionMapper, but that didn't work as it was instead handled by the exception mapper from Quarkus.

Yeap, exceptions (re)thrown from Exception Mappers are not routed through other mappers...

Also adds an additional integration-test, checking that a HTTP 500 is returned if a subclass of ValidationException is thrown, and renames ValidationExceptionsResource to fix a typo.

Excellent.

The branch passes both run-jvm-tests and run-native-tests, but fails when running ./mvnw verify with an exception:

java.lang.IllegalStateException: The current thread cannot be blocked: vert.x-eventloop-thread-0

However, as the master branch fails with the same exception on my machine, I assume it's unrelated to the changes made in this branch.

Don't worry about it then, I'll look into it separately, maybe there are some defaults for maven profiles missing.

@lwitkowski lwitkowski merged commit 9b394bc into quarkiverse:master Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ValidationException should not result in HTTP 400 status
2 participants