diff --git a/swig/parsedexpression.i b/swig/parsedexpression.i
index 6fcffb016421c31c748e4bda08735c2182833e9b..a77f1f351dfb21263366a5e7e794a14731660543 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>;