summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-03-31 18:26:54 +0200
committerRobin Gareus <robin@gareus.org>2020-03-31 18:58:12 +0200
commit5253c7eb8b39a82d0232828b7b1cff4c5622ce0a (patch)
tree12553d9bd1f4099381fc969e370a06bb633c8067 /libs/gtkmm2ext
parent5774be46fe5dc7e877fa50ef709a16f8ed621c2f (diff)
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.
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r--libs/gtkmm2ext/gtk_ui.cc32
1 files changed, 28 insertions, 4 deletions
diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc
index e38ba71d45..067f712198 100644
--- a/libs/gtkmm2ext/gtk_ui.cc
+++ b/libs/gtkmm2ext/gtk_ui.cc
@@ -514,16 +514,40 @@ void
UI::dump_errors (std::ostream& ostr, size_t limit)
{
Glib::Threads::Mutex::Lock lm (error_lock);
- ostr << endl << X_("Errors/Messages:") << endl;
- for (list<string>::const_iterator i = error_stack.begin(); i != error_stack.end(); ++i) {
- ostr << *i << endl;
- if (limit > 0) {
+ 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) {
+ ostr << "..." << endl;
+ break;
+ }
+ }
+ }
+ }
ostr << endl;
}