Run submission in a separate thread, and more explicit state

Also more explicit timeouts and an overall better handling of errors.
This commit is contained in:
2018-08-14 16:36:43 +02:00
parent 5d86b87f40
commit b64577df2e
8 changed files with 191 additions and 66 deletions

View File

@@ -5,7 +5,7 @@ import blf
import bpy
from ..foundation import util
from ..submission.client import CommunicationError
from ..submission import exceptions
from . import G
@@ -231,8 +231,16 @@ def _after_submission_text() -> str:
return f'Unable to connect to the Open Data platform. ' \
f'Please check your internet connection and try again.'
if isinstance(ex, requests.exceptions.Timeout):
return f'There was a timeout communicating with the Open Data platform. ' \
f'Please check your internet connection and try again.'
if isinstance(ex, exceptions.TokenTimeoutError):
return f'There was a timeout waiting for a Client Authentication token. ' \
f'This is fine, just try again.'
# If not our own exception class, show generic message.
if not isinstance(ex, CommunicationError):
if not isinstance(ex, exceptions.CommunicationError):
return f'Error submitting your results: {ex}'
# Return proper message based on the HTTP status code of the response.