summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-12-09 11:00:22 +0000
committerCarl Hetherington <cth@carlh.net>2014-12-09 11:00:22 +0000
commit1d04ff19d3480966b4d157013cb87c9fc3fc44f9 (patch)
tree6bcd2679f59a5edea9f8edcd85af5191bf7fc930 /src/lib
parente159aafa457003982101cb6c03674d5e2ed2c0ab (diff)
Hand apply 5e96dbee6de3b4baf82083e5c7169f27e6051c5b from master; give a nicer error when writing config fails.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/config.cc13
1 files changed, 9 insertions, 4 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