improve error detection and messages

This commit is contained in:
Axel Kohlmeyer
2023-11-12 10:04:04 -05:00
parent be6fcaa77f
commit 3390a11312

View File

@ -3397,18 +3397,18 @@ tagint Variable::int_between_brackets(char *&ptr, int varallow)
char *id = start+2;
int ivar = find(id);
if (ivar < 0)
error->all(FLERR,"Invalid variable name in variable formula");
error->all(FLERR,"Invalid variable name {} in variable formula", id);
char *var = retrieve(id);
if (var == nullptr)
error->all(FLERR,"Invalid variable evaluation in variable formula");
error->all(FLERR,"Invalid variable evaluation for variable {} in variable formula", id);
index = static_cast<tagint> (atof(var));
} else index = ATOTAGINT(start);
*ptr = ']';
if (index == 0)
if (index <= 0)
error->all(FLERR,"Index between variable brackets must be positive");
return index;
}