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 error is
without reading javadoc
3) exception classes can contain error-related data that is easy to retrieve
4) you cannot forget to handle a checked exception
5) if someone adds a new error code you do not have to hunt down all
the places that now need to be changed - once again you get a compile
time error
6) a bunch of other stuff i dont feel like typing out

-igor

On Wed, Sep 30, 2009 at 7:55 AM, Nicolas Melendez
<[email protected]> wrote:
> 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 <[email protected]> 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 could show an error
>> message
>> by calling "Component.error" and then use a filter to catch all error
>> messages targeting a specific FormComponent.
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/User-name-validation---how-to-check-database-to-find-if-a-name-has--already-been-taken--tp25614625p25682499.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to