Crocoddyl
 
Loading...
Searching...
No Matches
exception.cpp
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.
8
9#include "crocoddyl/core/utils/exception.hpp"
10
11namespace crocoddyl {
12
13Exception::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
25Exception::~Exception() NOEXCEPT {}
26
27const char *Exception::what() const NOEXCEPT { return msg_.c_str(); }
28
29std::string Exception::getMessage() const { return exception_msg_; }
30
31std::string Exception::getExtraData() const { return extra_data_; }
32
33} // namespace crocoddyl