Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

Exception Translation

All C++ exceptions must be caught at the boundary with Python code. This boundary is the point where C++ meets Python. Boost.Python provides a default exception handler that translates selected standard exceptions, then gives up:

raise RuntimeError, 'unidentifiable C++ Exception'

Users may provide custom translation. Here's an example:

struct PodBayDoorException;
void translator(PodBayDoorException const& x) {
    PyErr_SetString(PyExc_UserWarning, "I'm sorry Dave...");
Copyright 2002-2005 Joel de Guzman, David Abrahams