diff --git a/swig/documentreader.i b/swig/documentreader.i index 1a4bf310479ec25181c39ff5d4afb6a8c41f9d93..df1a87d5dff263fce45240072caa2627584491ce 100644 --- a/swig/documentreader.i +++ b/swig/documentreader.i @@ -6,13 +6,31 @@ #include <libcorpus2/io/docreader.h> %} +%include "exception.i" %include "document.i" %include "boost_shared_ptr.i" namespace Corpus2 { class DocumentReader { public: + %exception { + try { + $action + } catch (PwrNlp::PwrNlpError &e) { + PyErr_SetString(PyExc_IndexError, e.info().c_str()); + return NULL; + } + } DocumentReader(const Tagset&, const std::string&, const std::string &); + + %exception { + try { + $action + } catch (PwrNlp::PwrNlpError &e) { + PyErr_SetString(PyExc_IndexError, e.info().c_str()); + return NULL; + } + } boost::shared_ptr<Document> read(); /* --------------------------------------------------------------------- */