Skip to content
Snippets Groups Projects
Commit 7e046918 authored by michal's avatar michal
Browse files

added python wrappers for wccl exceptions

parent 3ce9a0ab
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.0) ...@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.0)
set(wccl_ver_major "0") set(wccl_ver_major "0")
set(wccl_ver_minor "3") set(wccl_ver_minor "3")
set(wccl_ver_patch "1") set(wccl_ver_patch "2")
set(LIBWCCL_VERSION "${wccl_ver_major}.${wccl_ver_minor}.${wccl_ver_patch}") set(LIBWCCL_VERSION "${wccl_ver_major}.${wccl_ver_minor}.${wccl_ver_patch}")
......
#ifndef LIBWCCL_EXCEPTION_H
#define LIBWCCL_EXCEPTION_H
%module libcorpusexception
%{
#include <libpwrutils/exception.h>
%}
%include "std_string.i"
%include "libpwrnlperror.i"
namespace Wccl {
class WcclError : public PwrNlp::PwrNlpError {
public:
WcclError(const std::string &what);
~WcclError() throw();
/* --------------------------------------------------------------------- */
std::string scope() const;
};
class InvalidArgument : public WcclError {
public:
InvalidArgument(const std::string& arg_name, const std::string& reason);
~InvalidArgument() throw();
/* --------------------------------------------------------------------- */
std::string info() const;
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;
using namespace Wccl;
#endif /* SWIG_LIBWCCL_EXCEPTION_I */
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment