diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-12-09 11:00:22 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-12-09 11:00:22 +0000 |
| commit | 1d04ff19d3480966b4d157013cb87c9fc3fc44f9 (patch) | |
| tree | 6bcd2679f59a5edea9f8edcd85af5191bf7fc930 /src | |
| parent | e159aafa457003982101cb6c03674d5e2ed2c0ab (diff) | |
Hand apply 5e96dbee6de3b4baf82083e5c7169f27e6051c5b from master; give a nicer error when writing config fails.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/config.cc | 13 | ||||
| -rw-r--r-- | src/tools/dcpomatic.cc | 5 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index a15825dc7..c571376f0 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -52,8 +52,7 @@ using std::exception; using std::cerr; using boost::shared_ptr; using boost::optional; -using boost::algorithm::is_any_of; -using boost::algorithm::split; +using boost::algorithm::trim; using dcp::raw_convert; Config* Config::_instance = 0; @@ -379,8 +378,14 @@ Config::write () const for (vector<boost::filesystem::path>::const_iterator i = _history.begin(); i != _history.end(); ++i) { root->add_child("History")->add_child_text (i->string ()); } - - doc.write_to_file_formatted (file().string ()); + + try { + doc.write_to_file_formatted (file().string ()); + } catch (xmlpp::exception& e) { + string s = e.what (); + trim (s); + throw FileError (s, file ()); + } } boost::filesystem::path diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 0c82898aa..27f029d9b 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -839,8 +839,11 @@ class App : public wxApp { try { throw; + } catch (FileError& e) { + error_dialog (0, wxString::Format (_("An exception occurred: %s in %s.\n\n" + REPORT_PROBLEM), e.what(), e.file().string().c_str ())); } catch (exception& e) { - error_dialog (0, wxString::Format (_("An exception occurred (%s)."), e.what ()) + " " + REPORT_PROBLEM); } catch (...) { + error_dialog (0, wxString::Format (_("An exception occurred: %s.\n\n"), e.what ()) + " " + REPORT_PROBLEM); + } catch (...) { error_dialog (0, _("An unknown exception occurred.") + " " + REPORT_PROBLEM); } |
