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:
Ghostkeeper 2021-10-12 11:30:12 +02:00
parent 025ef743ee
commit 125c80430b
No known key found for this signature in database
GPG key ID: 68F39EA88EEED5FF
2 changed files with 16 additions and 5 deletions

View file

@ -81,12 +81,20 @@ class UploadMaterialsJob(Job):
def onUploadCompleted(self, reply: "QNetworkReply", error: Optional["QNetworkReply.NetworkError"]):
if error is not None:
Logger.error(f"Failed to upload material archive: {error}")
self.setError(UploadMaterialsError(error))
self.setResult(self.Result.FAILED)
else:
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"]):
Logger.error(f"Failed to upload material archive: {error}")
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