diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-02-12 22:32:08 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-02-12 22:32:08 +0000 |
| commit | e7e200bdbc071ed3116905cc81c0d3e226de0298 (patch) | |
| tree | e2c350d5d16e3587fd4c92cc2679d34f3b681e5b /src | |
| parent | d8c3cdf82816acdecab1d13e364fd120b69b4498 (diff) | |
Small use of String::compose.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/exceptions.h | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index e757d2506..6de8806e4 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -25,10 +25,10 @@ */ #include <stdexcept> -#include <sstream> #include <cstring> #include <boost/exception/all.hpp> #include <boost/thread.hpp> +#include "compose.hpp" /** @class StringError * @brief A parent class for exceptions using messages held in a std::string @@ -140,12 +140,7 @@ public: ReadFileError (std::string f, int e = 0) : FileError ("", f) { - std::stringstream s; - s << "could not read from file " << f; - if (e) { - s << " (" << strerror (e) << ")"; - } - _what = s.str (); + _what = String::compose ("could not read from file %1 (%2)", f, strerror (e)); } }; @@ -161,12 +156,7 @@ public: WriteFileError (std::string f, int e) : FileError ("", f) { - std::stringstream s; - s << "could not write to file " << f; - if (e) { - s << " (" << strerror (e) << ")"; - } - _what = s.str (); + _what = String::compose ("could not write to file %1 (%2)", f, strerror (e)); } }; |
