Tweak error-dump (when session load fails)
When limiting the message count (e.g. for display in a dialog), use reverse order, and only print errors. When loading a session fails, the most recent error is more likely the real cause.
This commit is contained in:
parent
5774be46fe
commit
5253c7eb8b
@ -514,8 +514,31 @@ void
|
||||
UI::dump_errors (std::ostream& ostr, size_t limit)
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (error_lock);
|
||||
ostr << endl << X_("Errors/Messages:") << endl;
|
||||
bool first = true;
|
||||
|
||||
if (limit > 0) {
|
||||
/* reverse listing, Errors only */
|
||||
for (list<string>::const_reverse_iterator i = error_stack.rbegin(); i != error_stack.rend(); ++i) {
|
||||
if ((*i).substr (0, 9) == X_("WARNING: ") || (*i).substr (0, 6) == X_("INFO: ")) {
|
||||
continue;
|
||||
}
|
||||
if (first) {
|
||||
first = false;
|
||||
}
|
||||
ostr << *i << endl;
|
||||
if (--limit == 0) {
|
||||
ostr << "..." << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (first) {
|
||||
for (list<string>::const_iterator i = error_stack.begin(); i != error_stack.end(); ++i) {
|
||||
if (first) {
|
||||
ostr << endl << X_("Log Messages:") << endl;
|
||||
first = false;
|
||||
}
|
||||
ostr << *i << endl;
|
||||
if (limit > 0) {
|
||||
if (--limit == 0) {
|
||||
@ -524,6 +547,7 @@ UI::dump_errors (std::ostream& ostr, size_t limit)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ostr << endl;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user