Raise exception instead of using assert
This commit is contained in:
parent
80bfccd9d3
commit
ff32f822ba
7 changed files with 27 additions and 12 deletions
|
@ -159,12 +159,14 @@ class TorManager(object):
|
|||
else:
|
||||
res_auth = self.send("AUTHENTICATE", conn)
|
||||
|
||||
assert "250 OK" in res_auth, "Authenticate error %s" % res_auth
|
||||
if "250 OK" not in res_auth:
|
||||
raise Exception("Authenticate error %s" % res_auth)
|
||||
|
||||
# Version 0.2.7.5 required because ADD_ONION support
|
||||
res_version = self.send("GETINFO version", conn)
|
||||
version = re.search(r'version=([0-9\.]+)', res_version).group(1)
|
||||
assert float(version.replace(".", "0", 2)) >= 207.5, "Tor version >=0.2.7.5 required, found: %s" % version
|
||||
if float(version.replace(".", "0", 2)) < 207.5:
|
||||
raise Exception("Tor version >=0.2.7.5 required, found: %s" % version)
|
||||
|
||||
self.setStatus("Connected (%s)" % res_auth)
|
||||
self.event_started.set(True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue