Add IndexError that omits array name

This commit is contained in:
Ingmar Schoegl 2025-01-25 12:51:03 -06:00 committed by Ray Speth
parent 21ca5e1b26
commit eb8d6595b8

View File

@ -72,6 +72,9 @@ string ArraySizeError::getMessage() const
string IndexError::getMessage() const string IndexError::getMessage() const
{ {
if (arrayName_ == "") {
return fmt::format("IndexError: {} outside valid range of 0 to {}.", m_, mmax_);
}
return fmt::format("IndexError: {}[{}] outside valid range of 0 to {}.", return fmt::format("IndexError: {}[{}] outside valid range of 0 to {}.",
arrayName_, m_, mmax_); arrayName_, m_, mmax_);
} }