From e60e44b919d8124f6d58b919cfb4e17965c8ee05 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 7 Jun 2021 15:03:46 +0200 Subject: [PATCH] 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. --- cura/OAuth2/AuthorizationHelpers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cura/OAuth2/AuthorizationHelpers.py b/cura/OAuth2/AuthorizationHelpers.py index d79f24df15..5b95b3a3bb 100644 --- a/cura/OAuth2/AuthorizationHelpers.py +++ b/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