Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2021-10-15 16:24:05 +0300
committerGhostkeeper <rubend@tutanota.com>2021-10-15 16:24:05 +0300
commite05fa87b4885a809c8c2b1a0746de85fd3b4da74 (patch)
tree1dfc362bd40a740e4191b140d9f2729e79ef924f /cura/PrinterOutput
parent4262dfaf5dcb1ece926285a3cd076203a3c612a9 (diff)
Handle errors reading material archive back in
It could be that this archive is not accessible any more for whatever reason. Write-only file systems, quarantined files, etc. Whatever the reason, Cura shouldn't crash on this because it's not in Cura's control. Contributes to issue CURA-8609.
Diffstat (limited to 'cura/PrinterOutput')
-rw-r--r--cura/PrinterOutput/UploadMaterialsJob.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/cura/PrinterOutput/UploadMaterialsJob.py b/cura/PrinterOutput/UploadMaterialsJob.py
index 79affeabd3..34e92ac8ef 100644
--- a/cura/PrinterOutput/UploadMaterialsJob.py
+++ b/cura/PrinterOutput/UploadMaterialsJob.py
@@ -128,8 +128,13 @@ class UploadMaterialsJob(Job):
upload_url = response_data["upload_url"]
self._archive_remote_id = response_data["material_profile_id"]
- with open(cast(str, self._archive_filename), "rb") as f:
- file_data = f.read()
+ try:
+ with open(cast(str, self._archive_filename), "rb") as f:
+ file_data = f.read()
+ except OSError as e:
+ Logger.error(f"Failed to load archive back in for sending to cloud: {type(e)} - {e}")
+ self.failed(UploadMaterialsError(catalog.i18nc("@text:error", "Failed to load the archive of materials to sync it with printers.")))
+ return
http = HttpRequestManager.getInstance()
http.put(
url = upload_url,