OP-4196 - better logging of file upload errors

This commit is contained in:
Petr Kalis 2022-11-22 18:15:27 +01:00
parent 3cd241d2db
commit 3b81c7f573

View file

@ -188,10 +188,17 @@ class IntegrateSlackAPI(pyblish.api.InstancePlugin):
channel=channel,
title=os.path.basename(p_file)
)
attachment_str += "\n<{}|{}>".format(
response["file"]["permalink"],
os.path.basename(p_file))
file_ids.append(response["file"]["id"])
if response.get("error"):
error_str = self._enrich_error(
str(response.get("error")),
channel)
self.log.warning(
"Error happened: {}".format(error_str))
else:
attachment_str += "\n<{}|{}>".format(
response["file"]["permalink"],
os.path.basename(p_file))
file_ids.append(response["file"]["id"])
if publish_files:
message += attachment_str