Add missing error-handling.

There was error handling for the url-request, but not for handling the subsequent resolution.
This commit is contained in:
Remco Burema 2025-05-13 08:29:30 +02:00
parent 43a055cfd5
commit b0f175bd5a

View File

@ -1895,7 +1895,14 @@ class CuraApplication(QtApplication):
query = QUrlQuery(url.query())
model_url = QUrl(query.queryItemValue("file", options=QUrl.ComponentFormattingOption.FullyDecoded))
def on_error(*args, **kwargs):
Logger.warning(f"Could not download file from {model_url.url()}")
Message(f"Could not download file: {str(model_url.url())}",
title= "Loading Model failed",
message_type=Message.MessageType.ERROR).show()
def on_finish(response):
try:
content_disposition_header_key = QByteArray("content-disposition".encode())
filename = model_url.path().split("/")[-1] + ".stl"
@ -1918,13 +1925,9 @@ class CuraApplication(QtApplication):
f.write(response.readAll())
self.readLocalFile(QUrl.fromLocalFile(tmp.name), add_to_recent_files=False)
def on_error(*args, **kwargs):
Logger.log("w", "Could not download file from {0}".format(model_url.url()))
Message("Could not download file: " + str(model_url.url()),
title= "Loading Model failed",
message_type=Message.MessageType.ERROR).show()
return
except Exception as ex:
Logger.warning(f"Exception {str(ex)}")
on_error()
self.getHttpRequestManager().get(
model_url.url(),