Skip to content

Commit

Permalink
Print error on logs if Specification loading fails (#2770)
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen authored May 15, 2024
2 parents 49bc7dc + 0d3660d commit 2e3ca53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spinetoolbox/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,10 @@ def load_specification_from_file(spec_path, local_data_dict, spec_factories, app
if spec_dict is None:
return None
spec_dict["definition_file_path"] = spec_path
spec = specification_from_dict(spec_dict, local_data_dict, spec_factories, app_settings, logger)
try:
spec = specification_from_dict(spec_dict, local_data_dict, spec_factories, app_settings, logger)
except KeyError:
spec = None
if spec is not None:
spec.definition_file_path = spec_path
return spec
Expand Down
1 change: 1 addition & 0 deletions spinetoolbox/ui_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,7 @@ def import_specification(self):
def_file, local_data, self._item_specification_factories, self._qsettings, self
)
if not specification:
self.msg_error.emit("Failed to load specification.")
return
self.undo_stack.push(AddSpecificationCommand(self._project, specification, save_to_disk=False))

Expand Down

0 comments on commit 2e3ca53

Please sign in to comment.