From 9ccfc72dca0652b0c1b0464b322b933a014057a7 Mon Sep 17 00:00:00 2001 From: john30 Date: Sun, 18 Oct 2015 10:15:11 +0200 Subject: [PATCH] allow subclasses to use m_lastError, put filename in m_lastError when open failed --- src/lib/ebus/filereader.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/ebus/filereader.h b/src/lib/ebus/filereader.h index 4f364fba..5cb22585 100644 --- a/src/lib/ebus/filereader.h +++ b/src/lib/ebus/filereader.h @@ -73,9 +73,10 @@ public: { ifstream ifs; ifs.open(filename.c_str(), ifstream::in); - if (!ifs.is_open()) + if (!ifs.is_open()) { + m_lastError = filename; return RESULT_ERR_NOTFOUND; - + } string line; size_t lastSep = filename.find_last_of('/'); size_t firstDot = filename.find_first_of('.'); @@ -251,6 +252,8 @@ private: /** whether this instance supports rows with defaults (starting with a star). */ bool m_supportsDefaults; +protected: + /** a @a string describing the last error position. */ string m_lastError;