Open matiwinnetou opened 10 years ago
Good idea. Would this be injected data or 1st class model data? Either way, @ControllerAdvice could do this very easily.
I don't know actually. Feel free to experiment, lately I cannot get my head around this. I am also thinking that if such an error did really occur a developer today can also inject this to a model. Injected Data would be a way to make this completely automatic I guess, exposing binding and validation errors as part of some namespace within runtime data (injected data)
You mean that @ControllerAdvice is appriopriate for this because one can register a global @ExceptionHandler there?
Right, exactly. Since Spring 3.0, the framework is pushing people towards handling exceptions outside of controller methods, either in @ExceptionHandlers defined at the controller, or in @ControlelrAdvice, or even in the global exception handlers in the XML context. I'm not sure what Google's original use cases behind injected data were, but I can't help but think page-level models are a strong fit here.
Which Atlassian Soy component are you referring to? I don't believe I've seen this before.
I'll get to play around with this in some projects I'm working on now, I'll report back after I've had a chance to give it a go.
What I understood from Google Soy implementation is that Runtime Injected Data ($ij) is mostly used things like global variables, resolved at runtime. It may make some sense to make Exceptions available as GlobalRuntimeData but on another hand it is an exception that rose in this particular controller, so should be local to this controller. This, however, had an disadvantage that we mix normal business data returned to the controller with an exception data.
This is an atlassian soy project. Maybe it is worth to look at this more. https://bitbucket.org/atlassian/atlassian-soy-templates
it would be good to handle form errors and put the automatically to model ,e.g Binding Errors, Validation Errors. Similar thing has been achieved in Atlassian Soy component.