Bec, you seem to own the code that makes the report and it's a part of your
project, it doesn't sound like a reusable "black box" library. I'd treat
each of these cases differently. The Framework Design Guidelines book
explains all of this clearly, and I highly recommend everyone in here keep a
copy by their bedside table.

 

Since your are the caller and author I'd say you have the right to catch the
two exceptions you mentions and deal with them (just don't catch Exception
and swallow).

 

However, if this was a reusable library I would tend to create something
like a ReportGenerationException which callers can always trust to catch
from calling the library methods. This would give you a more generic and
friendly error message about what went wrong, but I would still have the
original as the InnerException. And the reusable library must not swallow
exceptions either. Never catch anything unless you know exactly what you're
going to do with it.

 

Greg

Reply via email to