mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Add fallback for if the example file can't be read
Fixes Sentry issue CURA-2KM.
This commit is contained in:
parent
1ccff0e3eb
commit
7ff86547ef
1 changed files with 7 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2020 Ultimaker B.V.
|
||||
# Copyright (c) 2021 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import json
|
||||
|
@ -87,8 +87,12 @@ class SliceInfo(QObject, Extension):
|
|||
return None
|
||||
file_path = os.path.join(plugin_path, "example_data.html")
|
||||
if file_path:
|
||||
with open(file_path, "r", encoding = "utf-8") as f:
|
||||
self._example_data_content = f.read()
|
||||
try:
|
||||
with open(file_path, "r", encoding = "utf-8") as f:
|
||||
self._example_data_content = f.read()
|
||||
except EnvironmentError as e:
|
||||
Logger.error(f"Unable to read example slice info data to show to the user: {e}")
|
||||
self._example_data_content = "<i>" + catalog.i18nc("@text", "Unable to read example data file.") + "</i>"
|
||||
return self._example_data_content
|
||||
|
||||
@pyqtSlot(bool)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue