[Python-Dev] Exception masking/chaining
Guido van Rossum
Thu, 12 Jun 2003 20:52:38 -0400
> > There's a lot of C code out there that catches e.g. AttributeError and
> > replaces it with a more specific error (e.g. BifurcationError("can't
> > bifurcate the sploorg") replacing AttributeError("__bifurcate__"). I
> > think this would cause end user confusion.
> But that is a different case. As I understand it, chaining would only
> occur if a second exception was raised *before* the current exception
> was caught -- e.g. if there's a bug in a piece of code in a finally
> block that's being executed while unwinding to find an exception
Interesting.. I had never even thought of this case. I thought
chaining was specifically when catching an exception and raising
another in its place.
To the people who came up with the idea, which is it?
(I can see an argument for both cases; maybe they should be supported
using different system attributes on the exception object?)
--Guido van Rossum (home page: http://www.python.org/~guido/)