summaryrefslogtreecommitdiff
path: root/gruel/src
diff options
context:
space:
mode:
Diffstat (limited to 'gruel/src')
-rw-r--r--gruel/src/swig/pmt_swig.i18
1 files changed, 18 insertions, 0 deletions
diff --git a/gruel/src/swig/pmt_swig.i b/gruel/src/swig/pmt_swig.i
index 3b0eb45c8..34c7d4b7c 100644
--- a/gruel/src/swig/pmt_swig.i
+++ b/gruel/src/swig/pmt_swig.i
@@ -36,6 +36,24 @@
using namespace pmt;
%}
+////////////////////////////////////////////////////////////////////////
+// Language independent exception handler
+////////////////////////////////////////////////////////////////////////
+%include exception.i
+
+%exception {
+ try {
+ $action
+ }
+ catch(std::exception &e) {
+ SWIG_exception(SWIG_RuntimeError, e.what());
+ }
+ catch(...) {
+ SWIG_exception(SWIG_RuntimeError, "Unknown exception");
+ }
+
+}
+
// Template intrusive_ptr for Swig to avoid dereferencing issues
class pmt_base;
//%import <intrusive_ptr.i>