The situation is that I have a dynamic library written in C++ that is wrapped for Python by another dynamic library, also written in C++ (generated by SIP to be specific). The first dynamic library defines a function do_raise
, which throws an exception RaiserError
, a subclass of std::exception
. The second dynamic library, in wrapping do_raise
, tries to catch RaiserError
in order to translate it to a Python exception.
Building with Visual C++, everything works as expected and RaiserError
is caught correctly. Using g++ on Linux however, RaiserError
is not caught. If I try to catch std::exception
instead (RaiserError
's baseclass), it works. What goes wrong here? Do the two libraries have different notions of the RaiserError
type, since it does not get recognized by the catch block?
For testing I also write a small executable which calls do_raise
in the C++ library, and here I am able to catch RaiserError
even with g++.