Browse Source

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.
Ghostkeeper 3 years ago
parent
commit
e60e44b919
1 changed files with 4 additions and 4 deletions
  1. 4 4
      cura/OAuth2/AuthorizationHelpers.py

+ 4 - 4
cura/OAuth2/AuthorizationHelpers.py

@@ -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