| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /////////////////////////////////////////////////////////////////////////////// | ||
| 2 | // BSD 3-Clause License | ||
| 3 | // | ||
| 4 | // Copyright (C) 2019-2023, University of Edinburgh, Heriot-Watt University | ||
| 5 | // Copyright note valid unless otherwise stated in individual files. | ||
| 6 | // All rights reserved. | ||
| 7 | /////////////////////////////////////////////////////////////////////////////// | ||
| 8 | |||
| 9 | #include "crocoddyl/core/utils/exception.hpp" | ||
| 10 | |||
| 11 | namespace crocoddyl { | ||
| 12 | |||
| 13 | ✗ | Exception::Exception(const std::string &msg, const char *file, const char *func, | |
| 14 | ✗ | int line) { | |
| 15 | ✗ | std::stringstream ss; | |
| 16 | ✗ | ss << "In " << file << "\n"; | |
| 17 | ✗ | ss << func << " "; | |
| 18 | ✗ | ss << line << "\n"; | |
| 19 | ✗ | ss << msg; | |
| 20 | ✗ | msg_ = ss.str(); | |
| 21 | ✗ | exception_msg_ = msg; | |
| 22 | ✗ | extra_data_ = file; | |
| 23 | ✗ | } | |
| 24 | |||
| 25 | ✗ | Exception::~Exception() NOEXCEPT {} | |
| 26 | |||
| 27 | ✗ | const char *Exception::what() const NOEXCEPT { return msg_.c_str(); } | |
| 28 | |||
| 29 | ✗ | std::string Exception::getMessage() const { return exception_msg_; } | |
| 30 | |||
| 31 | ✗ | std::string Exception::getExtraData() const { return extra_data_; } | |
| 32 | |||
| 33 | } // namespace crocoddyl | ||
| 34 |