[C++-sig] Catching Boost.Python.ArgumentError

Alex Mohr amohr at pixar.com
Mon Apr 26 18:33:32 CEST 2010


On 4/26/2010 1:22 AM, Austin Bingham wrote:
> I feel like I'm missing something simple, but how do I catch
> Boost.Python.ArgumentException? As far as I can tell, the Boost.Python
> module is not something I can import explicitly, so I can't write
> "catch Boost.Python.ArgumentException:". I can do something like
> comparing type and module name strings, but that just feels inelegant
> and a trouble for maintenance. Any ideas would be very welcome.

I haven't looked at the code in awhile but I think I do it by intentionally 
generating an ArgumentError, catching it, and in the handler where I have the 
exception object, I store its class away for later use.

Alex


More information about the Cplusplus-sig mailing list