Handle UpdateCheckerSOCKSHTTPError exception in the update_checker module

This commit is contained in:
Micah Lee 2017-04-15 18:15:01 -07:00
parent a116d3ae60
commit ca16600d29

View File

@ -78,7 +78,7 @@ def check_for_updates(force=False, bundled_tor_func=None):
raise UpdateCheckerTorError
# Download the latest-version file over Tor
#try:
try:
(socks_address, socks_port) = onion.get_tor_socks_port()
socks.set_default_proxy(socks.SOCKS5, socks_address, socks_port)
@ -96,14 +96,14 @@ def check_for_updates(force=False, bundled_tor_func=None):
# Clean up from Onion
onion.cleanup()
#except:
# raise UpdateCheckerSOCKSHTTPError
except:
raise UpdateCheckerSOCKSHTTPError
# Validate that latest_version looks like a version string
# This regex is: 1-3 dot-separated numeric components
version_re = r"^(\d+\.)?(\d+\.)?(\d+)$"
if not re.match(version_re, latest_version):
raise UpdateCheckerInvalidLatestVersion
raise UpdateCheckerInvalidLatestVersion(latest_version)
# Update the last checked timestamp (dropping the seconds and milliseconds)
timestamp = datetime.datetime.now().replace(microsecond=0).replace(second=0).timestamp()