exception.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2019, CNRS
3  * Copyright 2018-2019, INRIA
4  */
5 
6 #include "eigenpy/exception.hpp"
8 
9 #include <boost/python/exception_translator.hpp>
10 
11 
12 namespace eigenpy
13 {
14  PyObject * Exception::pyType;
15 
17  {
18  assert(NULL!=pyType);
19  // Return an exception object of type pyType and value object(e).
20  PyErr_SetString(PyExc_RuntimeError, e.what());
21  }
22 
24  {
25  if(check_registration<eigenpy::Exception>()) return;
26 
27  pyType = boost::python::class_<eigenpy::Exception>
28  ("Exception",boost::python::init<std::string>())
29  .add_property("message", &eigenpy::Exception::copyMessage)
30  .ptr();
31 
32  boost::python::register_exception_translator<eigenpy::Exception>
34  }
35 
36 } // namespace eigenpy
std::string copyMessage() const
Definition: exception.hpp:30
static void translateException(Exception const &e)
Definition: exception.cpp:16
static PyObject * pyType
Definition: exception.hpp:37
const char * what() const
Definition: exception.hpp:24
static void registerException()
Definition: exception.cpp:23


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Apr 17 2021 02:37:59