Commit 8e3a1607 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

libdatrwxx [WP]: revise error message texts

Try to make error messages better understandable for end-users. Amongst other
requirements, the library must identify itself.
parent 0f9f1de2
......@@ -31,8 +31,10 @@
* - 07/07/2006 V1.1 added report function
* - 06/09/2011 V1.2 introduced report_deprecated
* - 10/06/2015 V1.3 update repository URL in report_deprecated
* - 05/07/2016 V1.4 thof: operate with string containers rather than
* with pointer to character arrays
* - 05/07/2016 V1.4 thof:
* - operate with string containers rather than with
* pointer to character arrays
* - revise error output
*
* ============================================================================
*/
......@@ -41,6 +43,8 @@
#include <iostream>
#include <datrwxx/error.h>
#include <datrwxx/aalibdatrwxx.h>
#include <datrwxx/util.h>
using std::cerr;
using std::endl;
......@@ -102,24 +106,26 @@ namespace datrw {
//! report
void Exception::base_report() const
{
cerr << "Exception report:" << endl;
cerr << "ERROR message from " << datrw::libversion << ":" << endl;
cerr << " A problem occured while "
"reading or writing time series data!" << endl;
if (Mmessage.empty())
{
cerr << " No message" << endl;
}
else
{
cerr << " message: " << Mmessage << endl;
}
if (!Mfile.empty())
{
cerr << " triggered in \"" << Mfile << "\" at line #" << Mline << endl;
cerr << " " << Mmessage << endl;
}
if (!Mcondition.empty())
{
cerr << " by violation of condition:" << endl
cerr << " Violation of condition" << endl
<< " \"" << Mcondition << "\"" << endl;
}
if (!Mfile.empty())
{
cerr << " triggered in \"" << Mfile << "\" at line #" << Mline << endl;
}
}
/*----------------------------------------------------------------------*/
......@@ -130,10 +136,13 @@ namespace datrw {
const int& line,
const std::string& condition)
{
std::cerr << std::endl;
std::cerr << "VIOLATION of condition: " << condition << std::endl;
std::cerr << "* in " << file << " at line " << line << std::endl;
std::cerr << "* message: " << message << std::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;
}
/*----------------------------------------------------------------------*/
......@@ -142,13 +151,14 @@ namespace datrw {
void report_deprecated(const std::string& function,
const std::string& reason)
{
std::cerr << "WARNING: program uses deprecated function in libdatrwxx\n"
<< "* " << function << std::endl;
std::cerr << "* This function should no longer be used because\n"
<< "* " << reason << std::endl;
std::cerr << "* Please open an issue at "
cerr << "WARNING: program uses deprecated function" << endl;
cerr << " \"" << function << "\"" << endl;
cerr << " from " << datrw::libversion << endl;
cerr << " This function should no longer be used because\n"
<< " " << reason << endl;
cerr << " Please report this issue at "
"http://git.scc.kit.edu/Seitosh/Seitosh"
<< std::endl;
<< endl;
}
} // namespace datrw
......
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