From 7fa25921e2f74eaee2463cda34b2e2ea25d9ed38 Mon Sep 17 00:00:00 2001
From: Igor Danielewicz <igor.danielewicz@pwr.edu.pl>
Date: Tue, 12 Jun 2018 15:23:08 +0200
Subject: [PATCH] Added same fix to the SWIG as in previous commit, but to
 tokenreader.

---
 swig/tokenreader.i | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/swig/tokenreader.i b/swig/tokenreader.i
index 4a77779..522c628 100644
--- a/swig/tokenreader.i
+++ b/swig/tokenreader.i
@@ -7,6 +7,7 @@
   #include <libcorpus2/io/helpers.h>
 %}
 
+%include <exception.i>
 %include "tag.i"
 %include "token.i"
 %include "chunk.i"
@@ -42,6 +43,10 @@ namespace Corpus2 {
       } catch (PwrNlp::PwrNlpError &e) {
         PyErr_SetString(PyExc_IndexError, e.info().c_str());
         return NULL;
+      } catch (xmlpp::parse_error &e) {
+        std::string s("xmlpp::parse_error: "), s2(e.what());
+        s = s + s2;
+        SWIG_exception(SWIG_RuntimeError, s.c_str());
       }
     }
     %feature("autodoc", "1");
@@ -56,6 +61,10 @@ namespace Corpus2 {
       } catch (PwrNlp::PwrNlpError &e) {
         PyErr_SetString(PyExc_IndexError, e.info().c_str());
         return NULL;
+      } catch (xmlpp::parse_error &e) {
+        std::string s("xmlpp::parse_error: "), s2(e.what());
+        s = s + s2;
+        SWIG_exception(SWIG_RuntimeError, s.c_str());
       }
     }
     %feature("autodoc", "1");
-- 
GitLab