if (variableValue.isLocal()) {
commandBuilder.setVariableLocal(variableName, variableValue.toTypedValue(engine, objectMapper));
} else {
commandBuilder.setVariable(variableName, variableValue.toTypedValue(engine, objectMapper));
}
} catch (RestException e) {
String errorMessage = String.format("Cannot %s case instance %s due to invalid variable %s: %s", transition, caseInstanceId, variableName, e.getMessage());
throw new RestException(e.getStatus(), e, errorMessage);