From 572721e20d19e7c7e5d7d4ebad469d8fb6d8c0f8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 6 Apr 2018 13:26:16 +0200 Subject: Catch ContainerFormatError when deserialising containers Only the deserialize() functions themselves may pass the ContainerFormatError on, because their callers will have to handle those errors anyway. Contributes to issue CURA-5045. --- plugins/CuraProfileReader/CuraProfileReader.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'plugins/CuraProfileReader') diff --git a/plugins/CuraProfileReader/CuraProfileReader.py b/plugins/CuraProfileReader/CuraProfileReader.py index 69b2187541..8630e885a5 100644 --- a/plugins/CuraProfileReader/CuraProfileReader.py +++ b/plugins/CuraProfileReader/CuraProfileReader.py @@ -1,9 +1,10 @@ -# Copyright (c) 2016 Ultimaker B.V. +# Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import configparser from UM.PluginRegistry import PluginRegistry from UM.Logger import Logger +from UM.Settings.ContainerFormatError import ContainerFormatError from UM.Settings.InstanceContainer import InstanceContainer # The new profile to make. from cura.ProfileReader import ProfileReader @@ -77,7 +78,10 @@ class CuraProfileReader(ProfileReader): profile.addMetaDataEntry("type", "quality_changes") try: profile.deserialize(serialized) - except Exception as e: # Parsing error. This is not a (valid) Cura profile then. + except ContainerFormatError as e: + Logger.log("e", "Error in the format of a container: %s", str(e)) + return None + except Exception as e: Logger.log("e", "Error while trying to parse profile: %s", str(e)) return None return profile -- cgit v1.2.3