Hi Greg, you've hit the nail right on the head. I always tend to
create "black box" classes even when they are specific to a single
project which complicates things and wastes my time. I have now seen
the error in my ways. Cheers

Thanks everyone for the help!

--Bec--

On Thu, Jun 10, 2010 at 9:43 AM, Greg Keogh <g...@mira.net> wrote:
> 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