improve error reporting for python style variables
This commit is contained in:
@ -985,8 +985,21 @@ char *Variable::retrieve(const char *name)
|
||||
str = data[ivar][1] = utils::strdup(result);
|
||||
} else if (style[ivar] == PYTHON) {
|
||||
int ifunc = python->variable_match(data[ivar][0],name,0);
|
||||
if (ifunc < 0)
|
||||
error->all(FLERR,"Python variable {} does not match Python function {}", name, data[ivar][0]);
|
||||
if (ifunc < 0) {
|
||||
if (ifunc == -1) {
|
||||
error->all(FLERR, "Could not find Python function {} linked to variable {}",
|
||||
data[ivar][0], name);
|
||||
} else if (ifunc == -2) {
|
||||
error->all(FLERR, "Python function {} for variable {} does not have a return value",
|
||||
data[ivar][0], name);
|
||||
} else if (ifunc == -3) {
|
||||
error->all(FLERR,"Python variable {} does not match variable name registered with "
|
||||
"Python function {}", name, data[ivar][0]);
|
||||
} else {
|
||||
error->all(FLERR, "Unknown error verifying function {} linked to python style variable {}",
|
||||
data[ivar][0],name);
|
||||
}
|
||||
}
|
||||
python->invoke_function(ifunc,data[ivar][1]);
|
||||
str = data[ivar][1];
|
||||
// if Python func returns a string longer than VALUELENGTH
|
||||
|
||||
Reference in New Issue
Block a user