Commit 6ba3a85c authored by thomas.forbriger's avatar thomas.forbriger

libdatrwxx [WP]: appropriatly format multi-line error messages

parent 9cc12ff2
......@@ -55,22 +55,34 @@ namespace datrw {
const int& line,
const std::string& condition)
{
if (t==Fnonfatal)
{
cerr << "ERROR (non-fatal)";
}
else if (t==Fwarning)
{
cerr << "WARNING";
}
else
{
cerr << "ERROR";
}
cerr << "ERROR message from " << datrw::libversion << ":" << endl;
cerr << " A problem occured while "
"reading or writing time series data!" << endl;
cerr << " reported by " << datrw::libversion << "!" << endl;
cerr << "| A problem occured while "
"reading or writing time series data" << endl;
if (!condition.empty())
{
cerr << " Violation of condition" << endl
<< " \"" << condition << "\"" << endl;
cerr << "| the following condition is violated:" << endl
<< "| \"" << condition << "\"" << endl;
}
if (!file.empty())
{
cerr << " triggered in \"" << file << "\" at line #" << line << endl;
cerr << "| in \"" << file << "\" at line #" << line << endl;
}
if (message.empty())
{
cerr << " No message" << endl;
cerr << "| no further comment is provided." << endl;
}
else
{
......@@ -81,11 +93,17 @@ namespace datrw {
{
posend=message.find(delimiter, pos);
len=posend-pos;
cerr << "| " << message.substr(pos, len) << endl;
cerr << "* ";
cerr << message.substr(pos, len) << endl;
if (posend!=std::string::npos) { len+=delimiter.length(); }
pos+=len;
} // while (posend!=std::string::npos)
} // if (message.empty())
if (t==Ffatal)
{
cerr << "This error is fatal. The program probably will abort..."
<< endl;
}
cerr.flush();
} // void report_violation(...)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment