Commit fc8f01ec authored by Alexandre's avatar Alexandre
Browse files

Remove calls to error method

parent daee82b3
......@@ -310,6 +310,8 @@ class RequestDOTException(RequestException):
class PipeliningException(Exception):
pass
class DOHException(Exception):
pass
class Request:
def __init__(self, qname, qtype='AAAA', use_edns=True, want_dnssec=False, no_ecs=True):
......@@ -555,16 +557,16 @@ class ConnectionDOT(Connection):
return False
except OpenSSL.SSL.SysCallError as e:
if self.verbose:
error("OpenSSL error: %s" % e.args[1], exit=False)
print("OpenSSL error: %s" % e.args[1], file=sys.stderr)
return False
except OpenSSL.SSL.ZeroReturnError:
# see #18
if self.verbose:
error("Error: The SSL connection has been closed (try with --nosni to avoid sending SNI ?)", exit=False)
print("Error: The SSL connection has been closed (try with --nosni to avoid sending SNI ?)", file=sys.stderr)
return False
except OpenSSL.SSL.Error as e:
if self.verbose:
error("OpenSSL error: %s" % ', '.join(err[0][2] for err in e.args), exit=False)
print("OpenSSL error: %s" % ', '.join(err[0][2] for err in e.args), file=sys.stderr)
return False
# RFC 7858, section 4.2 and appendix A
......@@ -767,11 +769,7 @@ class ConnectionDOH(Connection):
if self.verbose:
print("Establishing multistreams connection...")
request = create_request('.', qtype='NS', dot=False)
try:
self.do_test(request, synchronous=False)
except OpenSSL.SSL.Error as e:
ok = False
error(e)
self.do_test(request, synchronous=False)
self.perform_multi(silent=True, display_results=False, show_time=False)
self.all_handles = []
self.finished = { 'http': {} }
......@@ -816,7 +814,7 @@ class ConnectionDOH(Connection):
try:
handle.perform()
except pycurl.error as e:
error(e.args[1])
raise DOHException(e.args[1])
def receive(self, handle):
request = handle.request
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment