Merge pull request #6179 from ynput/enhancement/OP-8067_publisher_action_error_raising

Publisher: Show message with error on action failure
This commit is contained in:
Jakub Ježek 2024-02-07 12:44:59 +01:00 committed by GitHub
commit 9058962d8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 0 deletions

View file

@ -2329,8 +2329,25 @@ class PublisherController(BasePublisherController):
result = pyblish.plugin.process(
plugin, self._publish_context, None, action.id
)
exception = result.get("error")
if exception:
self._emit_event(
"publish.action.failed",
{
"title": "Action failed",
"message": "Action failed.",
"traceback": "".join(
traceback.format_exception(exception)
),
"label": action.__name__,
"identifier": action.id
}
)
self._publish_report.add_action_result(action, result)
self.emit_card_message("Action finished.")
def _publish_next_process(self):
# Validations of progress before using iterator
# - same conditions may be inside iterator but they may be used

View file

@ -315,6 +315,9 @@ class PublisherWindow(QtWidgets.QDialog):
controller.event_system.add_callback(
"convertors.find.failed", self._on_convertor_error
)
controller.event_system.add_callback(
"publish.action.failed", self._on_action_error
)
controller.event_system.add_callback(
"export_report.request", self._export_report
)
@ -992,6 +995,18 @@ class PublisherWindow(QtWidgets.QDialog):
event["title"], new_failed_info, "Convertor:"
)
def _on_action_error(self, event):
self.add_error_message_dialog(
event["title"],
[{
"message": event["message"],
"traceback": event["traceback"],
"label": event["label"],
"identifier": event["identifier"]
}],
"Action:"
)
def _update_create_overlay_size(self):
metrics = self._create_overlay_button.fontMetrics()
height = int(metrics.height())