diff options
-rw-r--r-- | gr-uhd/swig/uhd_swig.i | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index 6f29f706d..5b3b52472 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -21,6 +21,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"); + } + +} + +//////////////////////////////////////////////////////////////////////// // standard includes //////////////////////////////////////////////////////////////////////// %include "gnuradio.i" |