mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-17 11:47:50 -06:00
Catch file writing errors while writing files in the archive
Seems really rare to me, but our users get every possible error some day. Fixes Sentry issue CURA-ZW.
This commit is contained in:
parent
3032221b70
commit
c7bbc139f7
1 changed files with 13 additions and 9 deletions
|
@ -127,6 +127,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
||||||
|
|
||||||
file_name = "Cura/%s.%s" % (container.getId(), file_suffix)
|
file_name = "Cura/%s.%s" % (container.getId(), file_suffix)
|
||||||
|
|
||||||
|
try:
|
||||||
if file_name in archive.namelist():
|
if file_name in archive.namelist():
|
||||||
return # File was already saved, no need to do it again. Uranium guarantees unique ID's, so this should hold.
|
return # File was already saved, no need to do it again. Uranium guarantees unique ID's, so this should hold.
|
||||||
|
|
||||||
|
@ -139,3 +140,6 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
||||||
serialized_data = container.serialize(ignored_metadata_keys = ignore_keys)
|
serialized_data = container.serialize(ignored_metadata_keys = ignore_keys)
|
||||||
|
|
||||||
archive.writestr(file_in_archive, serialized_data)
|
archive.writestr(file_in_archive, serialized_data)
|
||||||
|
except (FileNotFoundError, EnvironmentError):
|
||||||
|
Logger.error("File became inaccessible while writing to it: {archive_filename}".format(archive_filename = archive.fp.name))
|
||||||
|
return
|
Loading…
Add table
Add a link
Reference in a new issue