Catch OSError and related errors when saving workspaces

This should prevent a crash when saving to a path that the file system doesn't support (because of e.g. disallowed symbols in the file name).

Instead it will now show an error message to the user.

Fixes Sentry issue CURA-157.
This commit is contained in:
Ghostkeeper 2020-09-08 13:01:10 +02:00
parent 6e2738a254
commit 1ce8ef3293
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -92,6 +92,10 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
self.setInformation(catalog.i18nc("@error:zip", "No permission to write the workspace here."))
Logger.error("No permission to write workspace to this stream.")
return False
except EnvironmentError as e:
self.setInformation(catalog.i18nc("@error:zip", "The operating system does not allow saving a project file to this location or with this file name."))
Logger.error("EnvironmentError when writing workspace to this stream: {err}".format(err = str(e)))
return False
mesh_writer.setStoreArchive(False)
return True