Skip to content
Snippets Groups Projects
Commit a18fc1b0 authored by Paweł Kędzia's avatar Paweł Kędzia
Browse files

Handle Exceptions in docreader wrapper.

parent 1d1f10c9
Branches
No related tags found
No related merge requests found
...@@ -6,13 +6,31 @@ ...@@ -6,13 +6,31 @@
#include <libcorpus2/io/docreader.h> #include <libcorpus2/io/docreader.h>
%} %}
%include "exception.i"
%include "document.i" %include "document.i"
%include "boost_shared_ptr.i" %include "boost_shared_ptr.i"
namespace Corpus2 { namespace Corpus2 {
class DocumentReader { class DocumentReader {
public: 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 &); 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(); boost::shared_ptr<Document> read();
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment