Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6179 from ynput/enhancement/OP-8067_publisher_act…
Browse files Browse the repository at this point in the history
…ion_error_raising

Publisher: Show message with error on action failure
  • Loading branch information
jakubjezek001 authored Feb 7, 2024
2 parents 0c37c0e + b39c41f commit 9058962
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
17 changes: 17 additions & 0 deletions openpype/tools/publisher/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -2329,8 +2329,25 @@ def run_action(self, plugin_id, action_id):
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
Expand Down
15 changes: 15 additions & 0 deletions openpype/tools/publisher/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ def __init__(self, parent=None, controller=None, reset_on_show=None):
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
)
Expand Down Expand Up @@ -992,6 +995,18 @@ def _on_convertor_error(self, event):
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())
Expand Down

0 comments on commit 9058962

Please sign in to comment.