51# ifdef HAVE_EXECINFO_H
57#ifndef DOXYGEN_SHOULD_SKIP_THIS
60 std::string _createMsg_(
const std::string& filename,
61 const std::string& function,
63 const std::string& msg) {
64 std::stringstream stream;
66 stream << std::endl << msg << std::endl;
69 << filename <<
":" << line <<
" in " << function <<
"()" << std::endl
70 <<
"--------------" << std::endl
71 <<
"! " << msg << std::endl
72 <<
"--------------" << std::endl;
78 std::exception(e), msg_(e.msg_), type_(e.type_), what_(e.what_) {}
80 Exception::Exception(std::string aMsg, std::string aType) :
81 std::exception(), msg_(
std::move(aMsg)), type_(
std::move(aType)) {
83 what_ =
"[pyAgrum] " + type_ +
": " + msg_;
85 what_ = type_ +
": " + msg_;
89# ifdef HAVE_EXECINFO_H
90# define callStackDepth 20
91 void* array[callStackDepth];
94 size = backtrace(array, callStackDepth);
95 strings = backtrace_symbols(array, size);
97 std::stringstream stream;
99 for (
size_t i = 1; i < size; ++i) {
100 stream << i <<
" :" << strings[i] << std::endl;
104 callstack_ = stream.str();
106 callstack_ =
"Callstack only in linux debug mode when execinfo.h available";
109 callstack_ =
"Callstack only in linux debug mod ewhen execinfo.h available";
Base class for all aGrUM's exceptions.
Exception(std::string aMsg="", std::string aType="Generic error")
gum is the global namespace for all aGrUM entities