I\'m trying to group the code that logs the exceptions and render a nice view in a few methods. At the moment the logic is sometime in the @RequestHand
I ran into to same problem a while ago. The ModelMap
or BindingResult
are explicitly not listed as supported argument types in the JavaDocs of @ExceptionHandler
, so this must have been intentional.
I reckon the reason behind it being that throwing exceptions in general could leave your ModelMap
in an inconsistent state. So depending on your situation you might consider
BindingResult
to the exception and extract it from the exception later for rendering purposesBeanValidation
does for example)HTH