C-wrapper includes file and lineno when unknown exceptino is encountered
This commit is contained in:
parent
1daec8ff63
commit
343efc6379
1 changed files with 5 additions and 3 deletions
|
|
@ -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; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===----------------------------------------------------------------------===*/
|
/*===----------------------------------------------------------------------===*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue