mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 10:17:52 -06:00
Catch environment errors when reading license file from package
The package may be inaccessible for whatever reason, which would crash Cura. New attempt to fix CURA-2RP (without breaking the unit test saying that this error should be raised by Uranium then).
This commit is contained in:
parent
f749bbef46
commit
9e1dc98cd1
2 changed files with 14 additions and 3 deletions
|
@ -682,9 +682,13 @@ class Toolbox(QObject, Extension):
|
|||
if not package_info:
|
||||
Logger.log("w", "Package file [%s] was not a valid CuraPackage.", file_path)
|
||||
return
|
||||
|
||||
license_content = self._package_manager.getPackageLicense(file_path)
|
||||
package_id = package_info["package_id"]
|
||||
|
||||
try:
|
||||
license_content = self._package_manager.getPackageLicense(file_path)
|
||||
except EnvironmentError as e:
|
||||
Logger.error(f"Could not open downloaded package {package_id} to read license file! {type(e)} - {e}")
|
||||
return
|
||||
if license_content is not None:
|
||||
# get the icon url for package_id, make sure the result is a string, never None
|
||||
icon_url = next((x["icon_url"] for x in self.packagesModel.items if x["id"] == package_id), None) or ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue