Better handling of HTTP connection errors during submission
This commit is contained in:
@@ -9,7 +9,6 @@ from ..submission.client import CommunicationError
|
||||
|
||||
from . import G
|
||||
|
||||
|
||||
WELCOME_TEXT = "Run the Quick Benchmark on the selected device to " \
|
||||
"get a fast measurement of your hardware's performance.\n" \
|
||||
"Usually takes less than 30 minutes."
|
||||
@@ -84,6 +83,7 @@ def benchmark_draw_post_pixel(arg1, arg2):
|
||||
result_platform = G.result_platform
|
||||
result_stats = G.result_stats
|
||||
result_dict = G.result_dict
|
||||
submission_exception = G.submission_exception
|
||||
|
||||
ui_scale = bpy.context.user_preferences.system.ui_scale
|
||||
blf.color(font_id, 1.0, 1.0, 1.0, 1.0)
|
||||
@@ -219,12 +219,18 @@ def _draw_benchmark_has_run(image_y, ui_scale, window_width, window_height):
|
||||
|
||||
|
||||
def _after_submission_text() -> str:
|
||||
import requests.exceptions
|
||||
ex = G.submission_exception
|
||||
|
||||
# Nothing wrong, just show the default text.
|
||||
if not ex:
|
||||
return BLURB_TEXT
|
||||
|
||||
# Generic message when we cannot reach MyData.
|
||||
if isinstance(ex, requests.exceptions.ConnectionError):
|
||||
return f'Unable to connect to the Open Data platform. ' \
|
||||
f'Please check your internet connection and try again.'
|
||||
|
||||
# If not our own exception class, show generic message.
|
||||
if not isinstance(ex, CommunicationError):
|
||||
return f'Error submitting your results: {ex}'
|
||||
|
Reference in New Issue
Block a user