capture 'TaskNotSetError'

This commit is contained in:
Jakub Trllo 2024-12-10 18:39:05 +01:00
parent b995c51f1c
commit 5d91c9ba98

View file

@ -26,7 +26,7 @@ from ayon_core.pipeline import Anatomy
from ayon_core.pipeline.version_start import get_versioning_start
from ayon_core.pipeline.template_data import get_template_data
from ayon_core.pipeline.publish import get_publish_template_name
from ayon_core.pipeline.create import get_product_name
from ayon_core.pipeline.create import get_product_name, TaskNotSetError
UNKNOWN = object()
@ -823,15 +823,23 @@ class ProjectPushItemProcess:
task_name = task_info["name"]
task_type = task_info["taskType"]
product_name = get_product_name(
self._item.dst_project_name,
task_name,
task_type,
self.host_name,
product_type,
self._item.variant,
project_settings=self._project_settings
)
try:
product_name = get_product_name(
self._item.dst_project_name,
task_name,
task_type,
self.host_name,
product_type,
self._item.variant,
project_settings=self._project_settings
)
except TaskNotSetError:
self._status.set_failed(
"Product name template requires task name."
" Please select target task to continue."
)
raise PushToProjectError(self._status.fail_reason)
self._log_info(
f"Push will be integrating to product with name '{product_name}'"
)