Skip to content
Snippets Groups Projects
Commit 82f23ae5 authored by michal's avatar michal
Browse files

przechwytywanie bledow WcclError w pythonie dla metody apply_all

parent 7e046918
Branches
No related merge requests found
#ifndef LIBWCCL_EXCEPTION_H
#define LIBWCCL_EXCEPTION_H
%module libcorpusexception
%module libwcclexception
%{
#include <libpwrutils/exception.h>
%}
......@@ -31,18 +31,6 @@ namespace Wccl {
std::string arg_name;
std::string reason;
};
%exception {
try {
$action
} catch (Wccl::InvalidArgument &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
} catch (PwrNlp::PwrNlpError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
}
using namespace std;
......
......@@ -32,14 +32,39 @@ namespace Matching {
void operator()(const shared_ptr<Corpus2::AnnotatedSentence>& sentence);
/* --------------------------------------------------------------------- */
%exception {
try {
$action
} catch (Wccl::WcclError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
void apply_all(const shared_ptr<Corpus2::AnnotatedSentence>& sentence);
%exception {
try {
$action
} catch (Wccl::WcclError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
void apply_all_sentence_wrapper(const shared_ptr<Corpus2::Sentence>& sentence);
/* --------------------------------------------------------------------- */
std::string to_string(const Corpus2::Tagset& tagset) const;
};
%exception {
try {
$action
} catch (Wccl::WcclError &e) {
PyErr_SetString(PyExc_IndexError, e.info().c_str());
return NULL;
}
}
}
}
......
......@@ -34,5 +34,6 @@
%include "lexicon.i"
%include "lexicons.i"
%include "wcclfile.i"
%include "exception.i"
#endif /* SWIG_LIBWCCL_I */
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment