Skip to content

Commit ba9b46c

Browse files
committed
Add workflow exception
1 parent 3e6f0b5 commit ba9b46c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/superannotate/lib/core/usecases.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2680,7 +2680,11 @@ def execute(self):
26802680
for step in [step for step in self._steps if "className" in step]:
26812681
if step.get("id"):
26822682
del step["id"]
2683-
step["class_id"] = annotation_classes_map[step["className"]]
2683+
step["class_id"] = annotation_classes_map.get(step["className"], None)
2684+
if not step["class_id"]:
2685+
raise AppException(
2686+
"Annotation class not found in set_project_workflow."
2687+
)
26842688

26852689
self._service.set_project_workflow_bulk(
26862690
team_id=self._project.team_id,
@@ -2700,6 +2704,17 @@ def execute(self):
27002704
attribute_group_name = attribute["attribute"]["attribute_group"][
27012705
"name"
27022706
]
2707+
if not annotations_classes_attributes_map.get(
2708+
f"{annotation_class_name}__{attribute_group_name}__{attribute_name}",
2709+
None,
2710+
):
2711+
raise AppException(
2712+
"Attribute group name or attribute name not found in set_project_workflow."
2713+
)
2714+
2715+
if not existing_workflows_map.get(step["step"], None):
2716+
raise AppException("Couldn't find step in workflow")
2717+
27032718
req_data.append(
27042719
{
27052720
"workflow_id": existing_workflows_map[step["step"]],

0 commit comments

Comments
 (0)