I use exceptions in this way:

- RuntimeException for all those things that shouldn't happen in a
normal environment. For example, databases/files problems, requests of
objects using wrong ids (something like the user changed the id in the
url to a wrong one). And I just shown a default error message.

- Exception for all things that can go wrong in a normal environment.
For example, the authentication method, a registration user that
checks for a unique username, etc.

Using this approach I can find bugs fast because I don't hide errors
(they will come directly to the log and the user screen) when
something goes wrong.

my 5c,

On Fri, Jul 24, 2009 at 5:04 AM, Kwhit<[email protected]> wrote:
>
>  On Jul 23, 3:11 pm, Eduardo Nunes <[email protected]> wrote:
>  > Shouldn't the server errors be treated as unchecked exceptions
>  > (extends RuntimeException)? Maybe a solution could be three
> methods,
>
> I've found my self coding RE's for just about everything now. I think
> they are the most undervalued part of the Java language during the
> development phase. Example
>
> try {
>    final File f = new File("Whatever);
>    ...do something with file
> } catch(final IOException e) {
>    throw new RuntimeException("Something went wrong with the file
> operation", e);
> }
>
> The big advantages are you don't have to think about dealing with
> problems whilst you're writing your 'happy day' code, you avoid
> declaring exceptions which just put's off the inevitable and normally
> shifts the problem into a place where you're not equipped to deal with
> it and lastly: often times, especially in a stateless environment, a
> RE is the right course of action.
>
> It also travels from server to client in GAE/GWT which is good.
>
> >
>



-- 
Eduardo S. Nunes
http://e-nunes.com.br

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to