mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 01:07:52 -06:00
Don't crash when material file is missing
This could happen because a material is deleted right at that moment, since the SendMaterialJob is done on a separate thread. Fixes Sentry issue CURA-JZ.
This commit is contained in:
parent
be43383474
commit
d9cdea9496
1 changed files with 7 additions and 3 deletions
|
@ -92,9 +92,13 @@ class SendMaterialJob(Job):
|
|||
parts = []
|
||||
|
||||
# Add the material file.
|
||||
with open(file_path, "rb") as f:
|
||||
parts.append(self.device.createFormPart("name=\"file\"; filename=\"{file_name}\""
|
||||
.format(file_name = file_name), f.read()))
|
||||
try:
|
||||
with open(file_path, "rb") as f:
|
||||
parts.append(self.device.createFormPart("name=\"file\"; filename=\"{file_name}\""
|
||||
.format(file_name = file_name), f.read()))
|
||||
except FileNotFoundError:
|
||||
Logger.error("Unable to send material {material_id}, since it has been deleted in the meanwhile.".format(material_id = material_id))
|
||||
return
|
||||
|
||||
# Add the material signature file if needed.
|
||||
signature_file_path = "{}.sig".format(file_path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue