[C++-sig] Custom exceptions

Gavin Doughtie gavin at doughtie.com
Sun Jun 1 20:13:41 CEST 2003

Just a note -- I did in fact realize that this is what the "scope" 
function is for. Now I'm writing a templated exception generator class 
for my custom exceptions. Once that's working (i.e. once I fix my 
boost::bind calls to not crash gcc 2.96) I'll post it.

Gavin Doughtie wrote:
> So, let's say I want to register a custom exception which python code 
> can catch, thusly:
> try:
>     doSomething()
> except mymodule.MyException e:
>     print e
> Is there anything in boost python that makes setting this up easy? I've 
> got a working exception translator and everything, but I don't see 
> anything equivalent to putting 
> "PyErr_NewException("mymodule.MyException", NULL, NULL)" into the system 
> dictionary during module initialization.
> Or am I just working too hard again?

More information about the Cplusplus-sig mailing list