Thanks Igor.Always is good another point of view.
NM
On Wed, Sep 30, 2009 at 5:14 PM, Igor Vaynberg wrote:
> actually you got it completely wrong. especially as your project, and
> the number of devs who work on it, grows exceptions are a much more
> scalable way of handling errors.
>
> 1) the c
actually you got it completely wrong. especially as your project, and
the number of devs who work on it, grows exceptions are a much more
scalable way of handling errors.
1) the compiler tells you exactly what the exceptions are right off the bat
2) exception class name gives you a clue as to what
The AbstractValidator approach is fine, or you can do it the shorter
way the Igor showed.
Either way, when the page that has the username is submitted, you're
going to have to write that record to the database, even if you don't
have all the info. The way you wrote the question, I presume you
why do you use an exception for user already exits?Don`t you think that
return true/false, could be better?
i said that, because if the application start growing, you will have lot of
exceptions class.
thanks,
NM
On Wed, Sep 30, 2009 at 4:43 PM, Paul Huang wrote:
>
>
>
> igor.vaynberg wrote:
>
igor.vaynberg wrote:
>
> form {
> onsubmit() {
>try {
> users.persist(getmodelobject());
>} catch (usernamealreadyexistsexception e) {
> error("error.username.exists");
>}
>}
> }
>
> -igor
>
Thanks, it works like a charm. I did not know I co
The AbstractValidator approach is fine, or you can do it the shorter
way the Igor showed.
Either way, when the page that has the username is submitted, you're
going to have to write that record to the database, even if you don't
have all the info. The way you wrote the question, I presume you a
form {
onsubmit() {
try {
users.persist(getmodelobject());
} catch (usernamealreadyexistsexception e) {
error("error.username.exists");
}
}
}
-igor
On Fri, Sep 25, 2009 at 9:05 AM, Ryan Gravener wrote:
> I think you are overcomplicating things. Vali
Ryan Gravener-3 wrote:
>
> I think you are overcomplicating things. Validate the users input, if
> two users want the same name within 1 second of each request you
> probably have bigger problems to deal with.
So you think my current solution (extending "AbstractValidator") is OK?
But I sti
I think you are overcomplicating things. Validate the users input, if
two users want the same name within 1 second of each request you
probably have bigger problems to deal with. Anyhow, when submit is
called, if you get a nonunique exception. Catch in dao/service and
throw an exception wicket