diff options
author | Keith Wall <kwall@apache.org> | 2015-04-03 13:33:59 +0000 |
---|---|---|
committer | Keith Wall <kwall@apache.org> | 2015-04-03 13:33:59 +0000 |
commit | 369c4e9791b2dd0122843bfb51ed6930c215e543 (patch) | |
tree | d0c3467b5ccec34fcfdb916b5d98c1c2370b9389 | |
parent | 4107358e3e6cd033195e6b7e95af6c4111feda88 (diff) | |
download | qpid-python-369c4e9791b2dd0122843bfb51ed6930c215e543.tar.gz |
QPID-6473: [Python Client] Replace old style exception syntax on a number of paths through 08..0-9 code
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1671072 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/python/qpid/connection08.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/qpid/python/qpid/connection08.py b/qpid/python/qpid/connection08.py index 1b794425c9..ae4ccfc7e0 100644 --- a/qpid/python/qpid/connection08.py +++ b/qpid/python/qpid/connection08.py @@ -162,11 +162,11 @@ class Connection: frame.channel = channel end = c.decode_octet() if end != self.FRAME_END: - garbage = "" - while end != self.FRAME_END: - garbage += chr(end) - end = c.decode_octet() - raise "frame error: expected %r, got %r" % (self.FRAME_END, garbage) + garbage = "" + while end != self.FRAME_END: + garbage += chr(end) + end = c.decode_octet() + raise FramingError("frame error: expected %r, got %r" % (self.FRAME_END, garbage)) return frame except EOF: # An EOF caught here can indicate an error decoding the frame, @@ -214,25 +214,25 @@ class Connection: flags = c.decode_octet() # TODO: currently ignoring flags framing_version = (flags & 0xc0) >> 6 if framing_version != 0: - raise "frame error: unknown framing version" + raise FramingError("frame error: unknown framing version") type = self.spec.constants.byid[c.decode_octet()].name frame_size = c.decode_short() if frame_size < 12: # TODO: Magic number (frame header size) - raise "frame error: frame size too small" + raise FramingError("frame error: frame size too small") reserved1 = c.decode_octet() field = c.decode_octet() subchannel = field & 0x0f channel = c.decode_short() reserved2 = c.decode_long() # TODO: reserved maybe need to ensure 0 if (flags & 0x30) != 0 or reserved1 != 0 or (field & 0xf0) != 0: - raise "frame error: reserved bits not all zero" + raise FramingError("frame error: reserved bits not all zero") body_size = frame_size - 12 # TODO: Magic number (frame header size) body = c.read(body_size) dec = codec.Codec(StringIO(body), self.spec) try: frame = Frame.DECODERS[type].decode(self.spec, dec, len(body)) except EOF: - raise "truncated frame body: %r" % body + raise FramingError("truncated frame body: %r" % body) frame.channel = channel frame.subchannel = subchannel end = c.decode_octet() @@ -241,7 +241,7 @@ class Connection: while end != self.FRAME_END: garbage += chr(end) end = c.decode_octet() - raise "frame error: expected %r, got %r" % (self.FRAME_END, garbage) + raise FramingError("frame error: expected %r, got %r" % (self.FRAME_END, garbage)) return frame def write_99_0(self, frame): |