24 vector<string>
split(
const std::string& toSplit,
const char& delim) {
26 vector<string> splitted;
27 stringstream ss(toSplit);
28 while (getline(ss, r, delim))
29 splitted.push_back(r);
34 string concat(
const vector<string>& toConcat,
const std::string& beforeItem,
const std::string& afterItem) {
36 for (
const string& item : toConcat) {
42 size_t pos = result.find_last_of(afterItem);
43 if (pos != string::npos)
44 result = result.substr(0, pos);
52 msg += string(100,
'!')+
'\n';
60 vector<string> lines =
split(e.what(),
'\n');
61 for (
const string& line : lines)
62 msg += string(level,
'\t')+line+
'\n';
66 }
catch (
const exception& e) {
72 msg += string(100,
'!');
std::string exceptionToString(const std::exception &e, uint32_t level=0)
The recursive method creates the formatted error message for the given exception and their nested sub...
A general exception of the program.
The file defines extended exceptions for the better error handling in the program.
std::vector< std::string > split(const std::string &toSplit, const char &delim)
It splits the input string, e.g. split("abc ab c", ' ') -> {"abc", "ab", "c"}.
virtual std::string whatIndented(uint32_t level=0) const
Virtual function returning the formatted error message.
std::string concat(const std::vector< std::string > &toConcat, const std::string &beforeItem, const std::string &afterItem)
Method concatenates the given strings, e.g. concat({"abc", "ab"}, "\t", "\n") -> "\tabc\n\tab".