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

ExceptionHandler should auto-wrap Grails ValidationException to get human-readable message #417

Open
amcclain opened this issue Oct 16, 2024 · 1 comment · May be fixed by #425
Open

ExceptionHandler should auto-wrap Grails ValidationException to get human-readable message #417

amcclain opened this issue Oct 16, 2024 · 1 comment · May be fixed by #425

Comments

@amcclain
Copy link
Member

In RestController we catch/wrap Grails GORM ValidationExceptions in our own Hoist version of the same - the Hoist class processes the message into something that's actually readable.

https://github.com/xh/hoist-core/blob/develop/grails-app/controllers/io/xh/hoist/RestController.groovy#L76

Any reason not to always do this within ExceptionHandler so it is the default serialization for that class of exceptions?

@lbwexler
Copy link
Member

lbwexler commented Dec 2, 2024

Nice catch -- we actually do this in ExceptionHandler already, just need to use it.

Generally, when we handle an exception and don't rethrow on the server, we want to use handleException(). It handles sanitization, and the special handling of RoutineExceptions, among other things.

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 a pull request may close this issue.

2 participants