Interpret timeouts as general connection errors

It's a similar problem for us.
We should really have used the HttpRequestManager for these things.

Fixes Sentry issue CURA-295.
This commit is contained in:
Ghostkeeper 2021-06-07 15:03:46 +02:00
parent 515c7459d3
commit e60e44b919
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -1,12 +1,12 @@
# Copyright (c) 2020 Ultimaker B.V.
# Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from datetime import datetime
import json
import random
from hashlib import sha512
from base64 import b64encode
from typing import Optional, Any, Dict, Tuple
from typing import Optional
import requests
from UM.i18n import i18nCatalog
@ -115,7 +115,7 @@ class AuthorizationHelpers:
token_request = requests.get(check_token_url, headers = {
"Authorization": "Bearer {}".format(access_token)
})
except requests.exceptions.ConnectionError:
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout):
# Connection was suddenly dropped. Nothing we can do about that.
Logger.logException("w", "Something failed while attempting to parse the JWT token")
return None