Commit d2df3df6 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][editor] Show error message on new asset creation failure

For example, if a default Algorithm can't be constructed because the
prefix used lacks the reference datformats, show the exception message
rather than make the application crash.
parent 0c48f1f3
......@@ -116,13 +116,19 @@ class AbstractAssetEditor(QWidget):
if ok_pressed:
user = self.context.meta["config"].user
error_message = None
status = False
if creation_type == AssetCreationDialog.NEW:
if self.asset_type.split_count() == 1:
asset_name = f"{asset_info}/1"
asset_name = f"{user}/{asset_info}/1"
status = self.asset_type.create_new(self.prefix_path, asset_name)
status = self.asset_type.create_new(self.prefix_path, asset_name)
except RuntimeError as error:
error_message = str(error)
elif creation_type == AssetCreationDialog.NEW_VERSION:
status = self.asset_type.create_new_version(
self.prefix_path, asset_info
......@@ -145,16 +151,17 @@ class AbstractAssetEditor(QWidget):
if not status:
self,"Error occurred"),
"The {} operation failed".format(
error_text =
"The {} operation failed".format(
if error_message:
error_text +="\nReason:{}".format(error_message))
QMessageBox.critical(self,"Error occurred"), error_text)
def _load_json(self, json_object):
"""To be implemented by subclass to load their specific JSON parts"""
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment