print error position if reading config fails

This commit is contained in:
john30
2015-03-27 22:36:12 +01:00
parent 5bd74035c5
commit 28b866af43
2 changed files with 16 additions and 3 deletions
+14 -1
View File
@@ -144,16 +144,26 @@ public:
if (result != RESULT_OK) {
if (!verbose) {
ifs.close();
ostringstream error;
error << filename <<":" << static_cast<unsigned>(lineNo);
m_lastError = error.str();
return result;
}
printErrorPos(row.begin(), end, it, filename, lineNo, result);
}
} else if (!verbose)
m_lastError = "";
}
ifs.close();
return RESULT_OK;
}
/**
* Return a @a string describing the last error position.
* @return a @a string describing the last error position.
*/
virtual string getLastError() { return m_lastError; }
/**
* Add a definition that was read from a file.
* @param begin an iterator to the first column of the definition row to read.
@@ -171,6 +181,9 @@ private:
/** whether this instance supports rows with defaults (starting with a star). */
bool m_supportsDefaults;
/** a @a string describing the last error position. */
string m_lastError;
};
#endif // LIBEBUS_FILEREADER_H_