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"
7 
8 #include <boost/python/exception_translator.hpp>
9 
10 #include "eigenpy/registration.hpp"
11 
12 namespace eigenpy {
13 PyObject* Exception::pyType;
14 
16  assert(NULL != pyType);
17  // Return an exception object of type pyType and value object(e).
18  PyErr_SetString(PyExc_RuntimeError, e.what());
19 }
20 
22  if (check_registration<eigenpy::Exception>()) return;
23 
24  pyType = boost::python::class_<eigenpy::Exception>(
25  "Exception", boost::python::init<std::string>())
26  .add_property("message", &eigenpy::Exception::copyMessage)
27  .ptr();
28 
29  boost::python::register_exception_translator<eigenpy::Exception>(
31 }
32 
33 } // namespace eigenpy
const char * what() const
Definition: exception.hpp:23
static void translateException(Exception const &e)
Definition: exception.cpp:15
static PyObject * pyType
Definition: exception.hpp:34
static void registerException()
Definition: exception.cpp:21
std::string copyMessage() const
Definition: exception.hpp:26


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Fri Jun 2 2023 02:10:26