Lipu Fei 5 лет назад
Родитель
Сommit
c841382bbd

+ 8 - 1
cura/Machines/VariantManager.py

@@ -85,7 +85,14 @@ class VariantManager:
                 if variant_definition not in self._machine_to_buildplate_dict_map:
                     self._machine_to_buildplate_dict_map[variant_definition] = OrderedDict()
 
-                variant_container = self._container_registry.findContainers(type = "variant", id = variant_metadata["id"])[0]
+                try:
+                    variant_container = self._container_registry.findContainers(type = "variant", id = variant_metadata["id"])[0]
+                except IndexError as e:
+                    # It still needs to break, but we want to know what variant ID made it break.
+                    msg = "Unable to find build plate variant with the id [%s]" % variant_metadata["id"]
+                    Logger.logException("e", msg)
+                    raise IndexError(msg)
+
                 buildplate_type = variant_container.getProperty("machine_buildplate_type", "value")
                 if buildplate_type not in self._machine_to_buildplate_dict_map[variant_definition]:
                     self._machine_to_variant_dict_map[variant_definition][buildplate_type] = dict()

+ 3 - 2
cura/Settings/CuraStackBuilder.py

@@ -129,8 +129,9 @@ class CuraStackBuilder:
             extruder_definition = registry.findDefinitionContainers(id = extruder_definition_id)[0]
         except IndexError as e:
             # It still needs to break, but we want to know what extruder ID made it break.
-            Logger.log("e", "Unable to find extruder with the id %s", extruder_definition_id)
-            raise e
+            msg = "Unable to find extruder definition with the id [%s]" % extruder_definition_id
+            Logger.logException("e", msg)
+            raise IndexError(msg)
 
         # get material container for extruders
         material_container = application.empty_material_container

+ 7 - 1
cura/Settings/ExtruderManager.py

@@ -381,7 +381,13 @@ class ExtruderManager(QObject):
         elif extruder_stack_0.definition.getId() != expected_extruder_definition_0_id:
             Logger.log("e", "Single extruder printer [{printer}] expected extruder [{expected}], but got [{got}]. I'm making it [{expected}].".format(
                 printer = global_stack.getId(), expected = expected_extruder_definition_0_id, got = extruder_stack_0.definition.getId()))
-            extruder_definition = container_registry.findDefinitionContainers(id = expected_extruder_definition_0_id)[0]
+            try:
+                extruder_definition = container_registry.findDefinitionContainers(id = expected_extruder_definition_0_id)[0]
+            except IndexError as e:
+                # It still needs to break, but we want to know what extruder ID made it break.
+                msg = "Unable to find extruder definition with the id [%s]" % expected_extruder_definition_0_id
+                Logger.logException("e", msg)
+                raise IndexError(msg)
             extruder_stack_0.definition = extruder_definition
 
     ##  Get all extruder values for a certain setting.