From 5b1c7b73d0cb2dbbf944c3be670a7f2d74547e0f Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 26 Sep 2011 21:22:13 -0700 Subject: swig: language independent exception handler --- gnuradio-core/src/lib/swig/gnuradio.i | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gnuradio-core/src') 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 @@ -25,6 +25,24 @@ // SWIG interface definition //////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +// 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 -- cgit