mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-17 03:37:48 -06:00
Prevent crash when unable to write to storage location for container manager
Or the temp directory. Fixes Sentry issue CURA-KY.
This commit is contained in:
parent
75aafa1e5c
commit
52b4e98056
1 changed files with 6 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2019 Ultimaker B.V.
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -206,8 +206,11 @@ class ContainerManager(QObject):
|
||||||
if contents is None:
|
if contents is None:
|
||||||
return {"status": "error", "message": "Serialization returned None. Unable to write to file"}
|
return {"status": "error", "message": "Serialization returned None. Unable to write to file"}
|
||||||
|
|
||||||
|
try:
|
||||||
with SaveFile(file_url, "w") as f:
|
with SaveFile(file_url, "w") as f:
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
|
except OSError:
|
||||||
|
return {"status": "error", "message": "Unable to write to this location.", "path": file_url}
|
||||||
|
|
||||||
return {"status": "success", "message": "Successfully exported container", "path": file_url}
|
return {"status": "success", "message": "Successfully exported container", "path": file_url}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue