mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Better error handling if there is no global stack
It reports that the workspace failed to load instead of crashing the entire application then. Contributes to issue CURA-5045.
This commit is contained in:
parent
d9e8d64e3f
commit
8b75a0e92b
1 changed files with 11 additions and 4 deletions
|
@ -192,8 +192,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
Logger.log("w", "Unknown container stack type '%s' from %s in %s",
|
Logger.log("w", "Unknown container stack type '%s' from %s in %s",
|
||||||
stack_type, file_name, project_file_name)
|
stack_type, file_name, project_file_name)
|
||||||
|
|
||||||
if len(global_stack_file_list) != 1:
|
if len(global_stack_file_list) > 1:
|
||||||
raise RuntimeError("More than one global stack file found: [%s]" % str(global_stack_file_list))
|
Logger.log("e", "More than one global stack file found: [{file_list}]".format(file_list = global_stack_file_list))
|
||||||
|
#But we can recover by just getting the first global stack file.
|
||||||
|
if len(global_stack_file_list) == 0:
|
||||||
|
Logger.log("e", "No global stack file found!")
|
||||||
|
raise FileNotFoundError("No global stack file found!")
|
||||||
|
|
||||||
return global_stack_file_list[0], extruder_stack_file_list
|
return global_stack_file_list[0], extruder_stack_file_list
|
||||||
|
|
||||||
|
@ -347,8 +351,11 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
self._machine_info.quality_changes_info = None
|
self._machine_info.quality_changes_info = None
|
||||||
|
|
||||||
# Load ContainerStack files and ExtruderStack files
|
# Load ContainerStack files and ExtruderStack files
|
||||||
global_stack_file, extruder_stack_files = self._determineGlobalAndExtruderStackFiles(
|
try:
|
||||||
file_name, cura_file_names)
|
global_stack_file, extruder_stack_files = self._determineGlobalAndExtruderStackFiles(
|
||||||
|
file_name, cura_file_names)
|
||||||
|
except FileNotFoundError:
|
||||||
|
return WorkspaceReader.PreReadResult.failed
|
||||||
machine_conflict = False
|
machine_conflict = False
|
||||||
# Because there can be cases as follows:
|
# Because there can be cases as follows:
|
||||||
# - the global stack exists but some/all of the extruder stacks DON'T exist
|
# - the global stack exists but some/all of the extruder stacks DON'T exist
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue