From ea7e8426db723968d91855af28a7c8b7a3482774 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 7 May 2013 21:41:33 -0700 Subject: gras: create common gras/exception.i header fix other misc swig warnings --- include/gras/exception.i | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 include/gras/exception.i (limited to 'include/gras/exception.i') 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 +{ + try{$action} + catch (const std::exception& e) + {SWIG_exception(SWIG_RuntimeError, e.what());} +} + +#endif /*INCLUDED_GRAS_EXCEPTION_I*/ -- cgit