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

Error handling #39

Open
matiwinnetou opened this issue Dec 2, 2013 · 5 comments
Open

Error handling #39

matiwinnetou opened this issue Dec 2, 2013 · 5 comments

Comments

@matiwinnetou
Copy link
Owner

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.

@phasebash
Copy link
Collaborator

Good idea. Would this be injected data or 1st class model data? Either way, @ControllerAdvice could do this very easily.

@matiwinnetou
Copy link
Owner Author

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)

@matiwinnetou
Copy link
Owner Author

You mean that @ControllerAdvice is appriopriate for this because one can register a global @ExceptionHandler there?

@phasebash
Copy link
Collaborator

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.

@matiwinnetou
Copy link
Owner Author

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

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

No branches or pull requests

2 participants