struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Jouravlev" <>
Subject Re: Are throwing RuntimeExceptions in a struts app 'that evil'?
Date Wed, 03 May 2006 21:29:24 GMT
On 5/3/06, Rick Reumann <> wrote:
> I think I've read over most of the conventional wisdom that talks
> about how throwing aRuntimeExceptions are a bad idea, especially from
> within a catch in a finally block (at least IDEA is warning me about
> it:) But my question is it really 'that' bad?

Won't you lose your first RTE when you throw another one from finally block?

> Do I really want to have to wrap that with a try/catch or declare that
> it throws WhateverException?  What does that really gain me?

I guess this is religion/style thing. I would never return SQLwhatever
exceptions to business/web layer, I would convert it.

If situation is correctable, you should catch the exception somewhere,
where you can correct the situation (I don't know, you wanted to
update, but there is no such row, so you can automatically call insert
right away). In this case you might rethrow it as a specific
exception, like PersistentObjectNotFoundException.

If situation is fatal, throw RTE and don't bother much to catch, the
thing blew up anyway.

If this is a business-related exception (say, all new hires must be
single girls from 18 to 29 yr old), return checked business exception.
Well, I guess this situation arises if you have business rules in the


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message