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 /gnuradio-core/src/lib/swig/gnuradio.i | |
parent | 05870f5408cb8e6015a9051cf52855551ef647a4 (diff) | |
download | gnuradio-5b1c7b73d0cb2dbbf944c3be670a7f2d74547e0f.tar.gz gnuradio-5b1c7b73d0cb2dbbf944c3be670a7f2d74547e0f.tar.bz2 gnuradio-5b1c7b73d0cb2dbbf944c3be670a7f2d74547e0f.zip |
swig: language independent exception handler
Diffstat (limited to 'gnuradio-core/src/lib/swig/gnuradio.i')
-rw-r--r-- | gnuradio-core/src/lib/swig/gnuradio.i | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i index 1856d5007..e365aeac7 100644 --- a/gnuradio-core/src/lib/swig/gnuradio.i +++ b/gnuradio-core/src/lib/swig/gnuradio.i @@ -26,6 +26,24 @@ //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// +// 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"); + } + +} + +//////////////////////////////////////////////////////////////////////// // Headers %{ |