From 501c3c1ceb57d2bf9ff50d64a873c2992c891493 Mon Sep 17 00:00:00 2001 From: Adam Radziszewski <adam.radziszewski@pwr.wroc.pl> Date: Thu, 26 May 2011 15:55:04 +0200 Subject: [PATCH] wrapped exceptions in op.get_T --- swig/parsedexpression.i | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/swig/parsedexpression.i b/swig/parsedexpression.i index 6fcffb0..a77f1f3 100644 --- a/swig/parsedexpression.i +++ b/swig/parsedexpression.i @@ -28,6 +28,15 @@ namespace Wccl { /* --------------------------------------------------------------------- */ template<class T> T& get(const std::string& var_name); + + %exception { + try { + $action + } catch (PwrNlp::PwrNlpError &e) { + PyErr_SetString(PyExc_IndexError, e.info().c_str()); + return NULL; + } + } %template(get_bool) get<Bool>; %template(get_tset) get<TSet>; %template(get_strset) get<StrSet>; -- GitLab