Skip to content

Commit

Permalink
Better error message for upload timeouts (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightriff authored Oct 24, 2023
1 parent 6021257 commit 630ea26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down
9 changes: 7 additions & 2 deletions lib/upload_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,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()
Expand All @@ -248,7 +249,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
Expand All @@ -266,7 +267,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
Expand Down

0 comments on commit 630ea26

Please sign in to comment.