[C++-sig] automating convertion y omy exception

Gennadiy Rozental rogeeff at gmail.com
Fri Jul 18 08:03:39 CEST 2008


Boost.Python throws bp::error_already_set in case any error occurred. But I
always need my own exception class to be thrown instead. In a result I've got
tons oftry catch block like this:

    try {
        // do something boost python related
    catch( bp::error_already_set & ) {
        throw MyException( __FUNCTION__, pyGetException() );

(pyGetException uses Python C API to get details about error, though it's
irrelevant to the question)

Question: is there any way to "automate" it, so I can avoid all these try/catch

More information about the Cplusplus-sig mailing list