This is not a solution I am not really happy with but one that works. I implement the HandlerExceptionResolver
Interface to catch all exceptions.
In the implemented Method I handle only the exception I am interested in. Then I send the caller a error code and tell him what he did wrong.
@Override
ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
if (ex instanceof MultipartException){
response.sendError(413,"Content is to big. Maximal allowed request size is: ${Application.MAX_REQUEST_SIZE}")
}
}