Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
  • Loading branch information
mrclary and ccordoba12 committed Oct 13, 2023
1 parent 0e585a0 commit 314c3ea
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions spyder/workers/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Third party imports
from qtpy.QtCore import QObject, Signal
import requests
from requests.adapters import SSLError, ConnectionError
from requests.adapters import ConnectionError, SSLError

# Local imports
from spyder import __version__
Expand All @@ -27,13 +27,14 @@
# Logger setup
logger = logging.getLogger(__name__)

ssl_error_msg = _(
'SSL certificate verification failed while checking for Spyder updates.<br><br>'
'Please contact your network administrator for assistance.'
SSL_ERROR_MSG = _(
'SSL certificate verification failed while checking for Spyder updates.'
'<br><br>Please contact your network administrator for assistance.'
)
connect_error_msg = _(
'Unable to connect to the internet while checking for Spyder updates. <br><br>'
'Make sure the connection is working properly.'

CONNECT_ERROR_MSG = _(
'Unable to connect to the internet while checking for Spyder updates.'
'<br><br>Make sure the connection is working properly.'
)


Expand Down Expand Up @@ -140,10 +141,10 @@ def start(self):
result = self.check_update_available()
self.update_available, self.latest_release = result
except SSLError as err:
error_msg = ssl_error_msg
error_msg = SSL_ERROR_MSG
logger.debug(err, stack_info=True)
except ConnectionError as err:
error_msg = connect_error_msg
error_msg = CONNECT_ERROR_MSG
logger.debug(err, stack_info=True)
except Exception as err:
error = traceback.format_exc()
Expand Down Expand Up @@ -278,10 +279,10 @@ def start(self):
os.remove(self.installer_path)
return
except SSLError as err:
error_msg = ssl_error_msg
error_msg = SSL_ERROR_MSG
logger.debug(err, stack_info=True)
except ConnectionError as err:
error_msg = connect_error_msg
error_msg = CONNECT_ERROR_MSG
logger.debug(err, stack_info=True)
except Exception as err:
error = traceback.format_exc()
Expand Down

0 comments on commit 314c3ea

Please sign in to comment.