(re)throw EOF exception when next_dvector() has not yet read any items

This commit is contained in:
Axel Kohlmeyer
2023-12-16 17:07:37 -05:00
parent df7f3b8dea
commit e100a42087
2 changed files with 5 additions and 2 deletions

View File

@ -189,8 +189,9 @@ void TextFileReader::next_dvector(double *list, int n)
char *ptr = next_line();
if (ptr == nullptr) {
// EOF
if (i < n) {
if (i == 0) { // EOF without any records
throw EOFException("EOF reached");
} else if (i < n) { // EOF with incomplete data
throw FileReaderException(
fmt::format("Incorrect format in {} file! {}/{} values", filetype, i, n));
}