Branch data Line data Source code
1 : : // Copyright (c) 2017 Jordan Lack <jlack1987@gmail.com> 2 : : // RDL - Robot Dynamics Library 3 : : // Licensed under the zlib license. See LICENSE for more details. 4 : : 5 : : #ifndef __RDL_FRAME_EXCEPTIONS__ 6 : : #define __RDL_FRAME_EXCEPTIONS__ 7 : : 8 : : /** 9 : : * @page frame_exceptions Frame Exceptions 10 : : * 11 : : * The RobotDynamics::ReferenceFrameException is an exception that is thrown 12 : : * when an operation is performed that violates kinematic rules involving reference 13 : : * frames. For example if two FramePoint objects are added together but they are 14 : : * expressed in different frames. This will throw a RobotDynamics::ReferenceFrameException 15 : : */ 16 : : 17 : : #include <stdexcept> 18 : : #include <exception> 19 : : 20 : : namespace RobotDynamics 21 : : { 22 : : /** 23 : : * @class ReferenceFrameException 24 : : * @ingroup reference_frame 25 : : * @brief A custom exception for frame operations 26 : : */ 27 : : class ReferenceFrameException : public std::exception 28 : : { 29 : : public: 30 : : /** 31 : : * @brief Constructor 32 : : * @param err 33 : : */ 34 : 1022 : explicit ReferenceFrameException(const std::string& err) : msg(err) 35 : : { 36 : 1022 : } 37 : : 38 : 1021 : virtual const char* what() const throw() 39 : : { 40 : 1021 : return msg.c_str(); 41 : : } 42 : : 43 : : std::string msg /**< Custom exception message*/; 44 : : }; 45 : : } // namespace RobotDynamics 46 : : #endif // ifndef __RDL_FRAME_EXCEPTIONS__