mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 03:07:53 -06:00
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.
This commit is contained in:
parent
4262dfaf5d
commit
e05fa87b48
1 changed files with 7 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue