provide error information for two more cases

This commit is contained in:
Axel Kohlmeyer
2025-03-13 05:31:41 -04:00
parent 0f10741f71
commit 9d70c8b8ae
4 changed files with 82 additions and 16 deletions

View File

@ -807,13 +807,13 @@ void utils::bounds(const char *file, int line, const std::string &str,
if (error) {
if ((nlo <= 0) || (nhi <= 0))
error->all(file, line, failed, "Invalid range string: {}", str);
constexpr char fmt[] = "Numeric index {} is out of bounds ({}-{}){}";
if (nlo < nmin)
error->all(file, line, failed, "Numeric index {} is out of bounds ({}-{})", nlo, nmin, nmax);
error->all(file, line, failed, fmt, nlo, nmin, nmax, errorurl(19));
else if (nhi > nmax)
error->all(file, line, failed, "Numeric index {} is out of bounds ({}-{})", nhi, nmin, nmax);
error->all(file, line, failed, fmt, nhi, nmin, nmax, errorurl(19));
else if (nlo > nhi)
error->all(file, line, failed, "Numeric index {} is out of bounds ({}-{})", nlo, nmin, nhi);
error->all(file, line, failed, fmt, nlo, nmin, nhi, errorurl(19));
}
}