use of org.graylog.plugins.pipelineprocessor.ast.exceptions.PrecomputeFailure in project graylog2-server by Graylog2.
the class Function method preprocessArgs.
default void preprocessArgs(FunctionArgs args) {
for (Map.Entry<String, Expression> e : args.getConstantArgs().entrySet()) {
final String name = e.getKey();
try {
final Object value = preComputeConstantArgument(args, name, e.getValue());
if (value != null) {
// noinspection unchecked
final ParameterDescriptor<Object, Object> param = (ParameterDescriptor<Object, Object>) args.param(name);
if (param == null) {
throw new IllegalStateException("Unknown parameter " + name + "! Cannot continue.");
}
args.setPreComputedValue(name, param.transform().apply(value));
}
} catch (Exception exception) {
log.debug("Unable to precompute argument value for " + name, exception);
throw new PrecomputeFailure(name, exception);
}
}
}
Aggregations