Skip to content
Snippets Groups Projects
Commit 4a58bc47 authored by junglecow's avatar junglecow
Browse files

[pyopenssl] Yet more exception fixes

parent 236ed046
No related branches found
No related tags found
No related merge requests found
......@@ -79,14 +79,19 @@ class SSLWrapper:
def __init__(this, sock=None, exc=None, errno=None, strerror=None, peer=None):
this.parent = IOError
this.exc = exc
errno = errno or gattr(exc, 'errno', 0)
strerror = strerror or gattr(exc, 'strerror') or gattr(exc, 'args')
if not isinstance(strerror, basestring): strerror = repr(strerror)
errno = errno or gattr(this.exc, 'errno', 0)
strerror = strerror or gattr(this.exc, 'strerror') or gattr(this.exc, 'args')
this.parent.__init__(this, errno, strerror)
this.parent.__init__(this, this.errno, this.strerror)
this.sock = sock
this.exc = exc
this.peer = peer
this.exc_name = None
this.exc_args = None
this.exc_str = None
this.exc_repr = None
if this.exc is not None:
this.exc_name = str(this.exc.__class__)
......@@ -96,7 +101,7 @@ class SSLWrapper:
if this.peer is None and sock is not None:
try:
ppeer = this.obj.getpeername()
ppeer = this.sock.getpeername()
if len(ppeer) == 2 and isinstance(ppeer[0], basestring) \
and isinstance(ppeer[1], int):
this.peer = ppeer
......@@ -104,7 +109,7 @@ class SSLWrapper:
def __str__(this):
s = str(this.__class__)
if this.peer: s += "for %s:%d" % this.peer
if this.peer: s += " for %s:%d" % this.peer
if this.errno is not None: s += ": [Errno: %d]" % this.errno
if this.strerror: s += " (%s)" % this.strerror
if this.exc_name:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment