Catch errors when building enumeration lists.

This commit is contained in:
Dan 2021-01-08 15:15:24 -05:00
parent 4bb4a93161
commit 336c093bf8
1 changed files with 7 additions and 0 deletions

View File

@ -586,6 +586,13 @@ class WorkflowService(object):
items = data_model.items() if isinstance(data_model, dict) else data_model
options = []
for item in items:
if value_column not in item:
raise ApiError.from_task("invalid_enum", f"The value column '{value_column}' does not exist for item {item}",
task=spiff_task)
if label_column not in item:
raise ApiError.from_task("invalid_enum", f"The label column '{label_column}' does not exist for item {item}",
task=spiff_task)
options.append({"id": item[value_column], "name": item[label_column], "data": item})
return options