Skip to content

Commit

Permalink
Improve error message when import fails
Browse files Browse the repository at this point in the history
  • Loading branch information
BigRoy committed Jan 31, 2025
1 parent 2c904e6 commit c2a461f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion client/ayon_silhouette/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
AYON_INSTANCE_ID,
CreatorError,
)
from ayon_core.pipeline.load import LoadError
from ayon_core.lib import BoolDef
from . import lib

Expand Down Expand Up @@ -278,8 +279,20 @@ def load(self, context, name=None, namespace=None, options=None):
# Import the file
fx.activate(node)
filepath = self.filepath_from_context(context)
fx.io_modules[self.io_module].importFile(filepath)

try:
fx.io_modules[self.io_module].importFile(filepath)
except AssertionError as exc:
# Provide better message than "importer not ready" when it fails
# to import
if str(exc) == "importer not ready":
raise LoadError(
f"Failed to import as '{self.io_module}':\n{filepath}"
f"\n\n"
f"Silhouette is unable to import the file. Most likely "
f"due to incompatibilities or mismatching filetype."
) from exc
raise
self._process_loaded(context, node)

# property.hidden = True # hide the attribute
Expand Down

0 comments on commit c2a461f

Please sign in to comment.