17 const std::string_view& msg,
const char* filename,
unsigned int line,
18 const char* function_name)
36 std::string err{e.what()};
37 if (!err.empty() && *err.rbegin() !=
'\n') err +=
"\n"s;
41 std::rethrow_if_nested(e);
44 if (
const auto idx = err.find(
"]"); idx != std::string::npos)
45 err =
"Exception message: "s + err.substr(idx + 1);
46 ret = err + std::string(
"==== MRPT exception backtrace ====\n") + ret;
48 catch (
const std::exception& er)
std::string to_string(T v)
Just like std::to_string(), but with an overloaded version for std::string arguments.
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
std::string exception_line_msg(const std::string_view &msg, const char *filename, unsigned int line, const char *function_name)
void impl_excep_to_str(const std::exception &e, std::string &ret, int lvl=0)
Recursive implementation for mrpt::exception_to_str()