diff options
author | Ghostkeeper <rubend@tutanota.com> | 2020-04-09 15:55:14 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2020-04-09 15:55:14 +0300 |
commit | 1047cdd76c330315249f9f276ee07cef8cbe7edc (patch) | |
tree | f0ad0ad01a1acefe9453cfbb08efa22c859e3e99 /plugins/UFPWriter | |
parent | 54b6c2a54e4d0f4362fb9e6c3cd6ce3ac43ed0ca (diff) |
Catch OSError when actually writing the UFP stream
This includes getting an error message when we don't have write access any more or when the file was deleted or connection lost while we were writing to it.
Fixes Sentry issue CURA-GX.
Diffstat (limited to 'plugins/UFPWriter')
-rw-r--r-- | plugins/UFPWriter/UFPWriter.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/UFPWriter/UFPWriter.py b/plugins/UFPWriter/UFPWriter.py index e085adfd47..bcafc7545c 100644 --- a/plugins/UFPWriter/UFPWriter.py +++ b/plugins/UFPWriter/UFPWriter.py @@ -1,4 +1,4 @@ -#Copyright (c) 2019 Ultimaker B.V. +#Copyright (c) 2020 Ultimaker B.V. #Cura is released under the terms of the LGPLv3 or higher. from typing import cast @@ -131,5 +131,11 @@ class UFPWriter(MeshWriter): added_materials.append(material_file_name) - archive.close() + try: + archive.close() + except OSError as e: + error_msg = catalog.i18nc("@info:error", "Can't write to UFP file:") + " " + str(e) + self.setInformation(error_msg) + Logger.error(error_msg) + return False return True |