Corrections to the way error strings are generated
This commit is contained in:
parent
5aa1f8b624
commit
7be17fd779
6 changed files with 13 additions and 6 deletions
|
|
@ -40,8 +40,6 @@ std::streamsize straccbuf::xsputn(const char * s, std::streamsize num)
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
// The first item received is the format string
|
// The first item received is the format string
|
||||||
str = std::string(s, num);
|
str = std::string(s, num);
|
||||||
index++;
|
|
||||||
return num;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
@ -68,9 +66,9 @@ std::streamsize straccbuf::xsputn(const char * s, std::streamsize num)
|
||||||
buf << std::string(s, num);
|
buf << std::string(s, num);
|
||||||
|
|
||||||
str = buf.str();
|
str = buf.str();
|
||||||
index++;
|
|
||||||
return num;
|
|
||||||
}
|
}
|
||||||
|
index++;
|
||||||
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ledger
|
} // namespace ledger
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
|
std::ostream::clear();
|
||||||
|
buf.pubseekoff(0, ios_base::beg);
|
||||||
buf.str.clear();
|
buf.str.clear();
|
||||||
buf.index = 0;
|
buf.index = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +81,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ACCUM(obj) (static_cast<straccstream&>(obj).str())
|
#define ACCUM(obj) (static_cast<const straccstream&>(obj).str())
|
||||||
|
|
||||||
} // namespace ledger
|
} // namespace ledger
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ std::ostringstream _desc_buffer;
|
||||||
string error_context()
|
string error_context()
|
||||||
{
|
{
|
||||||
string context = _ctxt_buffer.str();
|
string context = _ctxt_buffer.str();
|
||||||
|
_ctxt_buffer.clear();
|
||||||
_ctxt_buffer.str("");
|
_ctxt_buffer.str("");
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ extern std::ostringstream _desc_buffer;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void throw_func(const string& message) {
|
inline void throw_func(const string& message) {
|
||||||
|
_desc_buffer.clear();
|
||||||
_desc_buffer.str("");
|
_desc_buffer.str("");
|
||||||
throw T(message);
|
throw T(message);
|
||||||
}
|
}
|
||||||
|
|
@ -62,6 +63,7 @@ inline void throw_func(const string& message) {
|
||||||
|
|
||||||
inline void warning_func(const string& message) {
|
inline void warning_func(const string& message) {
|
||||||
std::cerr << "Warning: " << message << std::endl;
|
std::cerr << "Warning: " << message << std::endl;
|
||||||
|
_desc_buffer.clear();
|
||||||
_desc_buffer.str("");
|
_desc_buffer.str("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,8 +143,10 @@ void interactive_t::verify_arguments() const
|
||||||
if (wrong_arg && optional && next_arg->is_null())
|
if (wrong_arg && optional && next_arg->is_null())
|
||||||
wrong_arg = false;
|
wrong_arg = false;
|
||||||
|
|
||||||
if (wrong_arg)
|
if (wrong_arg) {
|
||||||
vlabel = next_arg->label();
|
vlabel = next_arg->label();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (! dont_skip) {
|
if (! dont_skip) {
|
||||||
if (is_seq) {
|
if (is_seq) {
|
||||||
|
|
|
||||||
|
|
@ -593,6 +593,7 @@ bool logger_func(log_level_t level)
|
||||||
}
|
}
|
||||||
|
|
||||||
*_log_stream << ' ' << _log_buffer.str() << std::endl;
|
*_log_stream << ' ' << _log_buffer.str() << std::endl;
|
||||||
|
_log_buffer.clear();
|
||||||
_log_buffer.str("");
|
_log_buffer.str("");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -663,6 +664,7 @@ void start_timer(const char * name, log_level_t lvl)
|
||||||
(*i).second.begin = TRUE_CURRENT_TIME();
|
(*i).second.begin = TRUE_CURRENT_TIME();
|
||||||
(*i).second.active = true;
|
(*i).second.active = true;
|
||||||
}
|
}
|
||||||
|
_log_buffer.clear();
|
||||||
_log_buffer.str("");
|
_log_buffer.str("");
|
||||||
|
|
||||||
#if defined(VERIFY_ON)
|
#if defined(VERIFY_ON)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue