LCOV - code coverage report
Current view: top level - src/rdl/rdl_dynamics/include/rdl_dynamics - RdlExceptions.hpp (source / functions) Hit Total Coverage
Test: projectcoverage.info Lines: 4 4 100.0 %
Date: 2024-12-13 18:04:46 Functions: 2 2 100.0 %
Branches: 0 0 -

           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_EXCEPTIONS_HPP__
       6                 :            : #define __RDL_EXCEPTIONS_HPP__
       7                 :            : 
       8                 :            : #include <stdexcept>
       9                 :            : #include <exception>
      10                 :            : 
      11                 :            : namespace RobotDynamics
      12                 :            : {
      13                 :            : /**
      14                 :            :  * @class RdlException
      15                 :            :  * @brief A custom exception
      16                 :            :  */
      17                 :            : class RdlException : public std::exception
      18                 :            : {
      19                 :            :   public:
      20                 :            :     /**
      21                 :            :      * @brief Constructor
      22                 :            :      * @param err
      23                 :            :      */
      24                 :         12 :     explicit RdlException(const std::string& err) : msg(err)
      25                 :            :     {
      26                 :         12 :     }
      27                 :            : 
      28                 :         12 :     virtual const char* what() const throw()
      29                 :            :     {
      30                 :         12 :         return msg.c_str();
      31                 :            :     }
      32                 :            : 
      33                 :            :     std::string msg /**< Custom exception message*/;
      34                 :            : };
      35                 :            : }  // namespace RobotDynamics
      36                 :            : #endif  // ifndef __RDL_EXCEPTIONS_HPP__

Generated by: LCOV version 1.14