Fail gracefully if writing the backup to a temp file crashes

Fixes sentry issue CURA-21W
This commit is contained in:
Kostas Karmas 2021-04-16 15:55:06 +02:00
parent 544b267447
commit df5c52d1c6

View File

@ -61,7 +61,11 @@ class RestoreBackupJob(Job):
app = CuraApplication.getInstance()
bytes_read = reply.read(self.DISK_WRITE_BUFFER_SIZE)
while bytes_read:
try:
write_backup.write(bytes_read)
except Exception as e:
Logger.logException("e", "An error occurred while writing the backup to a temporary file: {}. The restoration of the backup is aborted.".format(e))
return
bytes_read = reply.read(self.DISK_WRITE_BUFFER_SIZE)
app.processEvents()