Those type of exceptions should be guarded against in your code (with
validators, etc.).  You shouldn't typically want to see them in
"production."  I don't do anything special to handle unchecked
exceptions for database problems because it's usually one of the
following issues:

1.  My code isn't working properly, meaning I'm not guarding against,
so my code needs to be fixed.
2.  The database is hosed and I can't do anything about it.


On Sun, Apr 11, 2010 at 11:38 AM, David Chang <david_q_zh...@yahoo.com> wrote:
> I am hoping to understand how to write a good wicket app regarding handling 
> exceptions from the databsae layer?
>
> For a wickt form, I can have the following to handle user submission:
>
> @Override
> protected void onSubmit() {
>  User u = getModelObject();
>  userDao.saveUser(u);
>  setResponsePage(Results.class);
> }
>
> For a wikcet web app, I can have many forms.
>
> But what is the best way to handle common database exceptions such as foreign 
> key constraint violation, larger than a column width, etc. and displaying 
> meaningful error messages? I could easily add try/catch around 
> userDao#saveUser to handle them, but that would be bad in terms of code 
> replication and maintenance. It may be good to handle in a "central" place.
>
> How do you deal with this issue in your wicket apps?
>
> Thanks for input!
>
> Best.
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to