[C++-sig] Re: Wrapper for exception translation

David Abrahams dave at boost-consulting.com
Thu Jul 10 13:19:13 CEST 2003


Gottfried.Ganssauge at HAUFE.DE writes:

> for my current project I was in need for a simple method to make user
> defined exceptions within my module.
> The basic framework in the form of exception translation is there so I only
> needed to make it a bit more accessible.
> I made a template function exception_<Exception> (const char *name) which
> creates a python exception and an instance of templated translation handler.
> The translation handler instance is held in the python translation's class
> dictionary as the __handler__ attribute.
> Then the handler is registered as an exception translator for the Exception
> using register_exception_translator().
> The python exception object is finally registered in the current scope's
> dictionary using the "name" argument to exception_().
>
> To register an exception translator for exception e you simply call
> exception_<e> ("e") within your module init function.
>
> This implementation is quite usable for me but I would be totally glad if it
> could somehow be integrated with pyste.

This looks like a question about integration with Boost.Python
itself to me.  Isn't it?

Could you explain how your facility improves on what's already in the
library?  I'm sorry to be dense, but the answer's not jumping out at
me.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list