From 1ce8ef3293d0f5409e01f7bc5f2bd3d89cf7b5d5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 8 Sep 2020 13:01:10 +0200 Subject: [PATCH] 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. --- plugins/3MFWriter/ThreeMFWorkspaceWriter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py index 69b1e51247..9f4ab8e5fa 100644 --- a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py +++ b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py @@ -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