Commit 5088acb2 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Catch KeyError exception only around the handler access to avoid handle this

exception during packet decoding or processing.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@685 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent defe50f8
......@@ -135,11 +135,12 @@ class EventHandler(object):
"""This is a helper method to handle various packet types."""
t = packet.getType()
try:
method = self.packet_dispatch_table[t]
try:
method = self.packet_dispatch_table[t]
except KeyError:
raise UnexpectedPacketError('no handler found')
args = packet.decode() or ()
method(conn, packet, *args)
except (KeyError, ValueError):
self.unexpectedPacket(conn, packet)
except UnexpectedPacketError, e:
self.unexpectedPacket(conn, packet, *e.args)
except PacketMalformedError, e:
......
Markdown is supported
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