summaryrefslogtreecommitdiff
path: root/include/gras/exception.i
diff options
context:
space:
mode:
authorJosh Blum2013-05-07 21:41:33 -0700
committerJosh Blum2013-05-07 21:41:33 -0700
commitea7e8426db723968d91855af28a7c8b7a3482774 (patch)
tree522aeb33958c41a58ea57a24fe85c6c3f7b59d1a /include/gras/exception.i
parent60a154123f4452d3699e25a245c145eed896f1d3 (diff)
downloadsandhi-ea7e8426db723968d91855af28a7c8b7a3482774.tar.gz
sandhi-ea7e8426db723968d91855af28a7c8b7a3482774.tar.bz2
sandhi-ea7e8426db723968d91855af28a7c8b7a3482774.zip
gras: create common gras/exception.i header
fix other misc swig warnings
Diffstat (limited to 'include/gras/exception.i')
-rw-r--r--include/gras/exception.i18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/gras/exception.i b/include/gras/exception.i
new file mode 100644
index 0000000..5ed2cd3
--- /dev/null
+++ b/include/gras/exception.i
@@ -0,0 +1,18 @@
+// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information.
+
+#ifndef INCLUDED_GRAS_EXCEPTION_I
+#define INCLUDED_GRAS_EXCEPTION_I
+
+////////////////////////////////////////////////////////////////////////
+// http://www.swig.org/Doc2.0/Library.html#Library_stl_exceptions
+////////////////////////////////////////////////////////////////////////
+%include <exception.i>
+
+%exception
+{
+ try{$action}
+ catch (const std::exception& e)
+ {SWIG_exception(SWIG_RuntimeError, e.what());}
+}
+
+#endif /*INCLUDED_GRAS_EXCEPTION_I*/