From 3614504483381f65fa143f7413a832d7d21f4d42 Mon Sep 17 00:00:00 2001 From: Nightriff <66378309+Nightriff@users.noreply.github.com> Date: Mon, 23 Oct 2023 04:05:45 -0700 Subject: [PATCH] Better error message for upload timeouts --- lib/constants.py | 3 ++- lib/upload_operator.py | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/constants.py b/lib/constants.py index 150ca13..3c61920 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -24,7 +24,8 @@ RBX_PACKAGE_ID_PROPERTY_NAME = "Roblox Package ID" ASSET_DESCRIPTION = "Uploaded from Blender" ERROR_MESSAGES = { - "TIMED_OUT": "Timed Out", + "UPLOAD_TIMED_OUT": "Upload Timed Out", + "OPERATION_TIMED_OUT": "Operation Timed Out", "INVALID_RESPONSE": "Invalid Response", "ADD_ON_ERROR": "Add-on Error", } diff --git a/lib/upload_operator.py b/lib/upload_operator.py index 99e9993..74189c5 100644 --- a/lib/upload_operator.py +++ b/lib/upload_operator.py @@ -236,6 +236,7 @@ def upload_task_complete(task, window_manager, area, target_object, temporary_di property and cleaning up from the operation.""" from . import status_indicators, constants import openapi_client + import asyncio try: operation = task.result() @@ -247,7 +248,7 @@ def upload_task_complete(task, window_manager, area, target_object, temporary_di elif not operation.done: # Timeout while polling for upload job to finish. It may yet finish or fail, but we stopped checking. status_indicators.set_status( - window_manager, area, target_object, constants.ERROR_MESSAGES["TIMED_OUT"], "ERROR" + window_manager, area, target_object, constants.ERROR_MESSAGES["OPERATION_TIMED_OUT"], "ERROR" ) elif operation.response: # Success @@ -265,7 +266,11 @@ def upload_task_complete(task, window_manager, area, target_object, temporary_di window_manager, area, target_object, constants.ERROR_MESSAGES["INVALID_RESPONSE"], "ERROR" ) print(f"Upload failed, invalid response:\n{operation}") - + except asyncio.exceptions.TimeoutError as exception: + # Timeout while waiting for initial upload to return an operation ID. It may yet finish or fail, but we stopped waiting. + status_indicators.set_status( + window_manager, area, target_object, constants.ERROR_MESSAGES["UPLOAD_TIMED_OUT"], "ERROR" + ) except openapi_client.rest.ApiException as exception: traceback.print_exception(exception) from .extract_exception_message import extract_exception_message