« Recognition gap | Main | Unit testing email »

"Pass-the-parcel" exceptions.

Hani makes a surprisingly unbilish point about wrapped exceptions. Wrapping already wrapped exceptions isn't the best idea in the world.

This technique reminds me of the children's game of "Pass the Parcel", where you put multiple layers of wrapping on a gift, and the children never know when they will reach the last one.

I'm as guilty of this as the next person, but I think in future I will modify the constructors of my wrapping exceptions so that if a cause already exists, it uses that as the cause, not the one supplied...

(FWIW, I'm not against wrapping exceptions; what is an ObjectNotFound at one layer is a ConfigurationException at another, and should be reflected as such).

This may, of course, just be a stupid idea, but it's worth exploring.

Post a comment


About

This page contains a single entry from the blog posted on August 25, 2004 7:24 AM.

The previous post in this blog was Recognition gap.

The next post in this blog is Unit testing email.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.35