mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge pull request #938 from ynput/bugfix/937-publish-validation-errors-show-traceback-in-artist-facing-reports
Publisher: Remove pyblish exception log from records
This commit is contained in:
commit
64a6322bb0
1 changed files with 18 additions and 4 deletions
|
|
@ -32,17 +32,20 @@ PLUGIN_ORDER_OFFSET = 0.5
|
||||||
class MessageHandler(logging.Handler):
|
class MessageHandler(logging.Handler):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.records = []
|
self._records = []
|
||||||
|
|
||||||
def clear_records(self):
|
def clear_records(self):
|
||||||
self.records = []
|
self._records = []
|
||||||
|
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
try:
|
try:
|
||||||
record.msg = record.getMessage()
|
record.msg = record.getMessage()
|
||||||
except Exception:
|
except Exception:
|
||||||
record.msg = str(record.msg)
|
record.msg = str(record.msg)
|
||||||
self.records.append(record)
|
self._records.append(record)
|
||||||
|
|
||||||
|
def get_records(self):
|
||||||
|
return self._records
|
||||||
|
|
||||||
|
|
||||||
class PublishErrorInfo:
|
class PublishErrorInfo:
|
||||||
|
|
@ -1328,7 +1331,18 @@ class PublishModel:
|
||||||
plugin, self._publish_context, instance
|
plugin, self._publish_context, instance
|
||||||
)
|
)
|
||||||
if log_handler is not None:
|
if log_handler is not None:
|
||||||
result["records"] = log_handler.records
|
records = log_handler.get_records()
|
||||||
|
exception = result.get("error")
|
||||||
|
if exception is not None and records:
|
||||||
|
last_record = records[-1]
|
||||||
|
if (
|
||||||
|
last_record.name == "pyblish.plugin"
|
||||||
|
and last_record.levelno == logging.ERROR
|
||||||
|
):
|
||||||
|
# Remove last record made by pyblish
|
||||||
|
# - `log.exception(formatted_traceback)`
|
||||||
|
records.pop(-1)
|
||||||
|
result["records"] = records
|
||||||
|
|
||||||
exception = result.get("error")
|
exception = result.get("error")
|
||||||
if exception:
|
if exception:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue