From 93e89bd463bd51de6823a6796288f6283f885b06 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 29 Sep 2019 23:28:57 +0200 Subject: Improve OpenFileError so that it doesn't say "opening for read" in one case where it should say "opening for read/write". Also add some unit tests for ReelWriter. --- src/lib/exceptions.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib/exceptions.cc') diff --git a/src/lib/exceptions.cc b/src/lib/exceptions.cc index 481d2e89d..bf474e3ea 100644 --- a/src/lib/exceptions.cc +++ b/src/lib/exceptions.cc @@ -27,10 +27,11 @@ using std::string; using std::runtime_error; /** @param f File that we were trying to open */ -OpenFileError::OpenFileError (boost::filesystem::path f, int error, bool reading) +OpenFileError::OpenFileError (boost::filesystem::path f, int error, Mode mode) : FileError ( String::compose ( - reading ? _("could not open file %1 for reading (%2)") : _("could not open file %1 for writing (%2)"), + mode == READ_WRITE ? _("could not open file %1 for read/write (%2)") : + (mode == READ ? _("could not open file %1 for read (%2)") : _("could not open file %1 for write (%2)")), f.string(), error), f -- cgit v1.2.3