From 3390a11312e81f79592d44351b781473937c3e27 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 12 Nov 2023 10:04:04 -0500 Subject: [PATCH] improve error detection and messages --- src/variable.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/variable.cpp b/src/variable.cpp index 264dcf6258..9c0307341a 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -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 (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; }