13
0

Display recent session-load errors in the GUI

Dumping errors to stderr only is not very useful. Particularly not
on Windows and MacOS.
Even though a user may not be able to address the issue, this
can lead to better reports vs just printing "corrupt state".
This commit is contained in:
Robin Gareus 2020-02-28 07:31:43 +01:00
parent fa0a7d6739
commit 003e68edd2
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -418,28 +418,34 @@ ARDOUR_UI::load_session_stage_two (const std::string& path, const std::string& s
goto out; goto out;
} }
catch (SessionException const& e) { catch (SessionException const& e) {
stringstream ss;
dump_errors (ss, 6);
dump_errors (cerr);
clear_errors ();
ArdourMessageDialog msg (string_compose( ArdourMessageDialog msg (string_compose(
_("Session \"%1 (snapshot %2)\" did not load successfully:\n%3"), _("Session \"%1 (snapshot %2)\" did not load successfully:\n%3%4%5"),
path, snap_name, e.what()), path, snap_name, e.what(), ss.str().empty() ? "" : "\n\n---", ss.str()),
true, false,
Gtk::MESSAGE_INFO, Gtk::MESSAGE_INFO,
BUTTONS_OK); BUTTONS_OK);
msg.set_title (_("Loading Error")); msg.set_title (_("Loading Error"));
msg.set_position (Gtk::WIN_POS_CENTER); msg.set_position (Gtk::WIN_POS_CENTER);
dump_errors (cerr);
(void) msg.run (); (void) msg.run ();
msg.hide (); msg.hide ();
goto out; goto out;
} }
catch (...) { catch (...) {
stringstream ss;
dump_errors (ss, 6);
dump_errors (cerr);
clear_errors ();
ArdourMessageDialog msg (string_compose( ArdourMessageDialog msg (string_compose(
_("Session \"%1 (snapshot %2)\" did not load successfully."), _("Session \"%1 (snapshot %2)\" did not load successfully.%3%4"),
path, snap_name), path, snap_name, ss.str().empty() ? "" : "\n\n---", ss.str()),
true, true,
Gtk::MESSAGE_INFO, Gtk::MESSAGE_INFO,
BUTTONS_OK); BUTTONS_OK);
@ -447,8 +453,6 @@ ARDOUR_UI::load_session_stage_two (const std::string& path, const std::string& s
msg.set_title (_("Loading Error")); msg.set_title (_("Loading Error"));
msg.set_position (Gtk::WIN_POS_CENTER); msg.set_position (Gtk::WIN_POS_CENTER);
dump_errors (cerr);
(void) msg.run (); (void) msg.run ();
msg.hide (); msg.hide ();
@ -611,20 +615,26 @@ ARDOUR_UI::build_session_stage_two (std::string const& path, std::string const&
new_session = new Session (*AudioEngine::instance(), path, snap_name, bus_profile.master_out_channels > 0 ? &bus_profile : NULL, meta_session ? "" : session_template); new_session = new Session (*AudioEngine::instance(), path, snap_name, bus_profile.master_out_channels > 0 ? &bus_profile : NULL, meta_session ? "" : session_template);
} }
catch (SessionException const& e) { catch (SessionException const& e) {
stringstream ss;
dump_errors (ss, 6);
cerr << "Here are the errors associated with this failed session:\n"; cerr << "Here are the errors associated with this failed session:\n";
dump_errors (cerr); dump_errors (cerr);
cerr << "---------\n"; cerr << "---------\n";
ArdourMessageDialog msg (string_compose(_("Could not create session in \"%1\": %2"), path, e.what())); clear_errors ();
ArdourMessageDialog msg (string_compose(_("Could not create session in \"%1\": %2%3%4"), path, e.what(), ss.str().empty() ? "" : "\n\n---", ss.str()));
msg.set_title (_("Loading Error")); msg.set_title (_("Loading Error"));
msg.set_position (Gtk::WIN_POS_CENTER); msg.set_position (Gtk::WIN_POS_CENTER);
msg.run (); msg.run ();
return -1; return -1;
} }
catch (...) { catch (...) {
stringstream ss;
dump_errors (ss, 6);
cerr << "Here are the errors associated with this failed session:\n"; cerr << "Here are the errors associated with this failed session:\n";
dump_errors (cerr); dump_errors (cerr);
cerr << "---------\n"; cerr << "---------\n";
ArdourMessageDialog msg (string_compose(_("Could not create session in \"%1\""), path)); clear_errors ();
ArdourMessageDialog msg (string_compose(_("Could not create session in \"%1\"%2%3"), path, ss.str().empty() ? "" : "\n\n---", ss.str()));
msg.set_title (_("Loading Error")); msg.set_title (_("Loading Error"));
msg.set_position (Gtk::WIN_POS_CENTER); msg.set_position (Gtk::WIN_POS_CENTER);
msg.run (); msg.run ();