diff options
author | Ghostkeeper <rubend@tutanota.com> | 2018-04-06 14:26:16 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2018-04-06 14:26:16 +0300 |
commit | 572721e20d19e7c7e5d7d4ebad469d8fb6d8c0f8 (patch) | |
tree | c5c8bfc5d66376dacc995b6dbfd9df856c7edd8e /plugins/GCodeProfileReader | |
parent | c9dc429b2b98977a258daa52f84189854e0f63f2 (diff) |
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.
Diffstat (limited to 'plugins/GCodeProfileReader')
-rw-r--r-- | plugins/GCodeProfileReader/GCodeProfileReader.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/GCodeProfileReader/GCodeProfileReader.py b/plugins/GCodeProfileReader/GCodeProfileReader.py index d6bda85a48..3ffbb9d910 100644 --- a/plugins/GCodeProfileReader/GCodeProfileReader.py +++ b/plugins/GCodeProfileReader/GCodeProfileReader.py @@ -1,9 +1,10 @@ -# Copyright (c) 2015 Ultimaker B.V. +# Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import re #Regular expressions for parsing escape characters in the settings. import json +from UM.Settings.ContainerFormatError import ContainerFormatError from UM.Settings.InstanceContainer import InstanceContainer from UM.Logger import Logger from UM.i18n import i18nCatalog @@ -113,6 +114,9 @@ def readQualityProfileFromString(profile_string): profile = InstanceContainer("") try: profile.deserialize(profile_string) + except ContainerFormatError as e: + Logger.log("e", "Corrupt profile in this g-code file: %s", str(e)) + return None except Exception as e: # Not a valid g-code file. Logger.log("e", "Unable to serialise the profile: %s", str(e)) return None |