From 6baea06e5bbaa5bf3ea30bebc2edfabbfa16ade4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20K=C4=99dzia?= <Pawel.Kedzia@pwr.wroc.pl>
Date: Tue, 10 May 2011 12:58:48 +0200
Subject: [PATCH] (swig) Handle exception thrown by
 Wccl::Parser::parseAnyOperator()

---
 swig/libcclparser.i | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/swig/libcclparser.i b/swig/libcclparser.i
index 2fb924a..46f0be7 100644
--- a/swig/libcclparser.i
+++ b/swig/libcclparser.i
@@ -77,6 +77,14 @@ namespace Wccl {
 
     /* --------------------------------------------------------------------- */
 
+    %exception {
+      try {
+        $action
+      } catch (PwrNlp::PwrNlpError &e) {
+        PyErr_SetString(PyExc_IndexError, e.info().c_str());
+        return NULL;
+      }
+    }
     shared_ptr<FunctionalOperator>  
       parseAnyOperator(const std::string& operator_string) const;
 
-- 
GitLab