acorn
acorn copied to clipboard
Handing of ValidationExceptions by exception handler
Version
Tested only on v4, but looking at the code it seems to be also present in v5.
What did you expect to happen?
When a ValidationException is thrown from a route, I would expect the request to be redirected to the previous page with an error bag or in the case of a JSON endpoint returning validation errors.
This behavior has been implemented in the Illuminate exception handler's convertValidationExceptionToResponse method. But Acorn's exception handler's render method overrides the base class' render method, which results in convertValidationExceptionToResponse never being called for ValidationExceptions.
Is there some reason for this simplified render method being used, instead of the full implementation which removes support for proper ValidationException handling? This could be fixed by either adding support for ValidationException to the render method override or otherwise maybe even just using the base method, if it doesn't cause any issues. Thoughts?
What actually happens?
ValidationExceptions are treated like any other exception and results in the generic error view being rendered.
Steps to reproduce
- Throw ValidationException in a route
- See that the exception does not result in a redirect or correct json response.
System info
No response
Log output
No response
Please confirm this isn't a support request.
Yes