diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-07-24 20:50:39 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-07-24 20:50:39 +0100 |
| commit | 82c647843ca58d21275db10a4b158cf046ea57fa (patch) | |
| tree | 25fd6c457fcb8c0f4cb5abdee91319ebd8b9c8fd /src/lib | |
| parent | 548e15c115c18937f8c8202ace05dcf0fe6a9374 (diff) | |
Add ReadFileError.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/exceptions.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index b16275c20..be5959d64 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -117,6 +117,28 @@ public: {} }; + +/** @class ReadFileError. + * @brief Indicates that some error occurred when trying to write to a file + */ +class ReadFileError : public FileError +{ +public: + /** @param f File that we were trying to read from. + * @param e errno value, or 0. + */ + ReadFileError (std::string f, int e) + : FileError ("", f) + { + std::stringstream s; + s << "could not read from file " << f; + if (e) { + s << " (" << strerror (e) << ")"; + } + _what = s.str (); + } +}; + /** @class WriteFileError. * @brief Indicates that some error occurred when trying to write to a file */ |
