[C++-sig] Re: boost::python embedding error handling

David Abrahams dave at boost-consulting.com
Fri Jul 2 05:40:04 CEST 2004


Jeffrey Holle <jeff.holle at verizon.net> writes:

> The good news is that now I can get useful error messages from
> boost::python, I'm more than willing to use it.  Its a keeper!
>
> I would like to provide some critism of the
> boost::python::error_already_set exceptions.
>
> 1.  It doesn't inherit from std::exception.

So what?

> 2.  It provides no information.

Incorrect.  Its type provides the information that Python has the rest
of the information.

> On the other hand, its concept of obtaining error information from
> the python interpreter is soundly a good idea.  Its just isn't
> finished.
>
> I've written what I would consider a replacement for it and attached
> it.  Note that the code it its constuctor is pretty much what Chad
> Austin contributed to this news group.  Thanks.

I don't consider replacing an exception whose constructor can't fail
with one whose constructor can fail to be an improvement.  Especially
not an exception whose copy-ctor can throw exceptions, which is just
plain evil because it might cause termination during stack
unwinding.  

You might want to read http://www.boost.org/more/error_handling.html I
realize I'm not taking my own advice to derive from std::exception.  

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com





More information about the Cplusplus-sig mailing list