.. _program_listing_file__tmp_ws_src_eigenpy_include_eigenpy_exception.hpp: Program Listing for File exception.hpp ====================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/eigenpy/include/eigenpy/exception.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright 2014-2019, CNRS * Copyright 2018-2019, INRIA */ #ifndef __eigenpy_exception_hpp__ #define __eigenpy_exception_hpp__ #include #include #include "eigenpy/fwd.hpp" namespace eigenpy { /* * Eigenpy exception. They can be catch with python (equivalent * eigenpy.exception class). */ class Exception : public std::exception { public: Exception() : message() {} Exception(const std::string &msg) : message(msg) {} const char *what() const throw() { return this->getMessage().c_str(); } ~Exception() throw() {} virtual const std::string &getMessage() const { return message; } std::string copyMessage() const { return getMessage(); } /* Call this static function to "enable" the translation of this C++ exception * in Python. */ static void registerException(); private: static void translateException(Exception const &e); static PyObject *pyType; protected: std::string message; }; } // namespace eigenpy #endif // ifndef __eigenpy_exception_hpp__