[C++-sig] Re: Custom Exception objects

Mike Rovner mrovner at propel.com
Wed Nov 3 00:16:35 CET 2004


John A Meinel wrote:
> I was wondering how to handle custom exception objects using boost::python.

> Since I have already wrapped ConfigError as a boost::python class, is it 
> possible to do something more like:

suppose you have

object my_python_exception =
class_<ConfigError>("ConfigError", init<char*>)
    ...
    ;

> static void translateConfigError(ConfigError const &e) {
>     PyErr_SetString(my_python_exception, e.what());
> }

than above statement will be perfectly valid

HTH,
Mike




More information about the Cplusplus-sig mailing list