diff options
author | Josh Blum | 2011-09-26 21:22:13 -0700 |
---|---|---|
committer | Johnathan Corgan | 2011-09-27 10:23:45 -0700 |
commit | 5b1c7b73d0cb2dbbf944c3be670a7f2d74547e0f (patch) | |
tree | 40dd14a914dd77f518edb5dc10d49b076212fbea /gruel/src/swig | |
parent | 05870f5408cb8e6015a9051cf52855551ef647a4 (diff) | |
download | gnuradio-5b1c7b73d0cb2dbbf944c3be670a7f2d74547e0f.tar.gz gnuradio-5b1c7b73d0cb2dbbf944c3be670a7f2d74547e0f.tar.bz2 gnuradio-5b1c7b73d0cb2dbbf944c3be670a7f2d74547e0f.zip |
swig: language independent exception handler
Diffstat (limited to 'gruel/src/swig')
-rw-r--r-- | gruel/src/swig/pmt_swig.i | 18 |
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> |