From 343efc6379747c95e039f503f8d07fa1b82bfeca Mon Sep 17 00:00:00 2001 From: Siu Kwan Lam Date: Thu, 17 Jan 2013 16:44:01 -0600 Subject: [PATCH] C-wrapper includes file and lineno when unknown exceptino is encountered --- llvm/wrap.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/llvm/wrap.h b/llvm/wrap.h index f19c80b..ce2dd88 100644 --- a/llvm/wrap.h +++ b/llvm/wrap.h @@ -60,6 +60,7 @@ #include "llvm_c_extra.h" #include +#include class py_exception: public std::exception{}; @@ -75,9 +76,10 @@ class py_exception: public std::exception{}; PyErr_SetString(PyExc_RuntimeError, e.what()); \ return NULL; \ } catch (...) { \ - PyErr_SetString(PyExc_RuntimeError, \ - "Unknown exception"); \ - return NULL; \ + std::ostringstream oss; \ + oss << "Unknown exception " << __FILE__ << ":" << __LINE__; \ + PyErr_SetString(PyExc_RuntimeError, oss.str().c_str()); \ + return NULL; \ } /*===----------------------------------------------------------------------===*/