26 const std::string msg = e.what();
27 std::vector<std::string> lines =
29 std::ostringstream message_stream;
30 message_stream << std::string(level,
' ') <<
"exception: ";
32 message_stream, lines.begin(), lines.end(),
"\n" + std::string(level,
' '));
38 catch(
const std::exception &e)
43 if(nested_message.back() !=
'\n')
45 message_stream <<
'\n';
47 message_stream << nested_message;
53 return message_stream.str();
std::string unwrap_exception(const std::exception &e, int level)
Given a potentially nested exception, produce a string with all of nested exceptions information.
Stream & join_strings(Stream &os, const It b, const It e, const Delimiter &delimiter)
Prints items to an stream, separated by a constant delimiter.
void util_rethrow_if_nested(const E &e)
void split_string(const std::string &s, char delim, std::vector< std::string > &result, bool strip, bool remove_empty)
Given a string s, split into a sequence of substrings when separated by specified delimiter.
#define UNREACHABLE
This should be used to mark dead code.