Commit 2276eecc authored by thomas.forbriger's avatar thomas.forbriger
Browse files

libdatrwxx [WP]: make report_violation fit for multiline messages

parent 0c5c97c4
......@@ -56,34 +56,37 @@ namespace datrw {
const std::string& condition)
{
cerr << "ERROR message from " << datrw::libversion << ":" << endl;
cerr << " A problem occured while "
"reading or writing time series data!" << endl;
if (message.empty())
{
cerr << " No message" << endl;
}
else
{
cerr << " " << message << endl;
}
if (!condition.empty())
{
cerr << " Violation of condition" << endl
<< " \"" << condition << "\"" << endl;
}
if (!file.empty())
{
cerr << " triggered in \"" << file << "\" at line #" << line << endl;
}
cerr << endl;
cerr << "ERROR: " << datrw::libversion << " ";
cerr << "reports violation of condition:" << endl;
cerr << " \"" << condition << "\"" << endl;
cerr << " while reading or writing time series data" << endl;
cerr << " in " << file << " at line " << line << endl;
cerr << " " << message << endl;
}
cerr << "ERROR message from " << 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;
}
if (!file.empty())
{
cerr << " triggered in \"" << file << "\" at line #" << line << endl;
}
if (message.empty())
{
cerr << " No message" << endl;
}
else
{
const std::string delimiter("\n");
std::string::size_type posend=0, pos=0;
std::string::size_type len=0;
while (posend!=std::string::npos)
{
posend=message.find(delimiter, pos);
len=posend-pos;
cerr << "| " << message.substr(pos, len) << endl;
if (posend!=std::string::npos) { len+=delimiter.length(); }
pos+=len;
} // while (posend!=std::string::npos)
} // if (message.empty())
} // void report_violation(...)
/*----------------------------------------------------------------------*/
......
Supports Markdown
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