mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-11 16:00:47 -07:00
Show more information about errors we're getting
Show the error code we received in the GUI, and allow expansion for different types of errors. Contributes to issue CURA-8609.
This commit is contained in:
parent
025ef743ee
commit
125c80430b
2 changed files with 16 additions and 5 deletions
|
|
@ -81,12 +81,20 @@ class UploadMaterialsJob(Job):
|
||||||
def onUploadCompleted(self, reply: "QNetworkReply", error: Optional["QNetworkReply.NetworkError"]):
|
def onUploadCompleted(self, reply: "QNetworkReply", error: Optional["QNetworkReply.NetworkError"]):
|
||||||
if error is not None:
|
if error is not None:
|
||||||
Logger.error(f"Failed to upload material archive: {error}")
|
Logger.error(f"Failed to upload material archive: {error}")
|
||||||
|
self.setError(UploadMaterialsError(error))
|
||||||
self.setResult(self.Result.FAILED)
|
self.setResult(self.Result.FAILED)
|
||||||
else:
|
else:
|
||||||
self.setResult(self.Result.SUCCESS)
|
self.setResult(self.Result.SUCCESS)
|
||||||
self.uploadCompleted.emit(self.getResult())
|
self.uploadCompleted.emit(self.getResult(), self.getError())
|
||||||
|
|
||||||
def onError(self, reply: "QNetworkReply", error: Optional["QNetworkReply.NetworkError"]):
|
def onError(self, reply: "QNetworkReply", error: Optional["QNetworkReply.NetworkError"]):
|
||||||
Logger.error(f"Failed to upload material archive: {error}")
|
Logger.error(f"Failed to upload material archive: {error}")
|
||||||
self.setResult(self.Result.FAILED)
|
self.setResult(self.Result.FAILED)
|
||||||
self.uploadCompleted.emit(self.getResult())
|
self.setError(UploadMaterialsError(error))
|
||||||
|
self.uploadCompleted.emit(self.getResult(), self.getError())
|
||||||
|
|
||||||
|
class UploadMaterialsError(Exception):
|
||||||
|
"""
|
||||||
|
Marker class to indicate something went wrong while uploading.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
@ -7,7 +7,7 @@ from typing import Optional, TYPE_CHECKING
|
||||||
import zipfile # To export all materials in a .zip archive.
|
import zipfile # To export all materials in a .zip archive.
|
||||||
|
|
||||||
import cura.CuraApplication # Imported like this to prevent circular imports.
|
import cura.CuraApplication # Imported like this to prevent circular imports.
|
||||||
from cura.PrinterOutput.UploadMaterialsJob import UploadMaterialsJob # To export materials to the output printer.
|
from cura.PrinterOutput.UploadMaterialsJob import UploadMaterialsJob, UploadMaterialsError # To export materials to the output printer.
|
||||||
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
|
|
@ -155,9 +155,12 @@ class CloudMaterialSync(QObject):
|
||||||
job.uploadCompleted.connect(self.exportUploadCompleted)
|
job.uploadCompleted.connect(self.exportUploadCompleted)
|
||||||
job.start()
|
job.start()
|
||||||
|
|
||||||
def exportUploadCompleted(self, job_result: UploadMaterialsJob.Result):
|
def exportUploadCompleted(self, job_result: UploadMaterialsJob.Result, job_error: Optional[Exception]):
|
||||||
if job_result == UploadMaterialsJob.Result.FAILED:
|
if job_result == UploadMaterialsJob.Result.FAILED:
|
||||||
self.sync_all_dialog.setProperty("syncStatusText", catalog.i18nc("@text", "Something went wrong when sending the materials to the printers."))
|
if isinstance(job_error, UploadMaterialsError):
|
||||||
|
self.sync_all_dialog.setProperty("syncStatusText", catalog.i18nc("@text", "Error sending materials to the Digital Factory:") + " " + str(job_error))
|
||||||
|
else: # Could be "None"
|
||||||
|
self.sync_all_dialog.setProperty("syncStatusText", catalog.i18nc("@text", "Unknown error."))
|
||||||
self._export_upload_status = "error"
|
self._export_upload_status = "error"
|
||||||
else:
|
else:
|
||||||
self._export_upload_status = "success"
|
self._export_upload_status = "success"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue