better error message for incorrect range string

This commit is contained in:
Axel Kohlmeyer
2021-03-01 12:36:29 -05:00
parent 76ef7a9081
commit 4b66c1e570

View File

@ -414,6 +414,9 @@ void utils::bounds(const char *file, int line, const std::string &str,
} }
if (error) { if (error) {
if ((nlo <= 0) || (nhi <=0))
error->all(file,line,fmt::format("Invalid range string: {}",str));
if (nlo < nmin) if (nlo < nmin)
error->all(file,line,fmt::format("Numeric index {} is out of bounds" error->all(file,line,fmt::format("Numeric index {} is out of bounds"
"({}-{})",nlo,nmin,nmax)); "({}-{})",nlo,nmin,nmax));