C-wrapper includes file and lineno when unknown exceptino is encountered

This commit is contained in:
Siu Kwan Lam 2013-01-17 16:44:01 -06:00
commit 343efc6379

View file

@ -60,6 +60,7 @@
#include "llvm_c_extra.h" #include "llvm_c_extra.h"
#include <new> #include <new>
#include <sstream>
class py_exception: public std::exception{}; class py_exception: public std::exception{};
@ -75,9 +76,10 @@ class py_exception: public std::exception{};
PyErr_SetString(PyExc_RuntimeError, e.what()); \ PyErr_SetString(PyExc_RuntimeError, e.what()); \
return NULL; \ return NULL; \
} catch (...) { \ } catch (...) { \
PyErr_SetString(PyExc_RuntimeError, \ std::ostringstream oss; \
"Unknown exception"); \ oss << "Unknown exception " << __FILE__ << ":" << __LINE__; \
return NULL; \ PyErr_SetString(PyExc_RuntimeError, oss.str().c_str()); \
return NULL; \
} }
/*===----------------------------------------------------------------------===*/ /*===----------------------------------------------------------------------===*/