diff --git a/src/py_exceptions.h b/src/py_exceptions.h index b1789d4b13d4..c1637fca70eb 100644 --- a/src/py_exceptions.h +++ b/src/py_exceptions.h @@ -46,6 +46,14 @@ class exception : public std::exception } \ return (errorcode); \ } \ + catch (const std::runtime_error &e) \ + { \ + PyErr_Format(PyExc_RuntimeError, "In %s: %s", (name), e.what()); \ + { \ + cleanup; \ + } \ + return (errorcode); \ + } \ catch (...) \ { \ PyErr_Format(PyExc_RuntimeError, "Unknown exception in %s", (name)); \