Skip to content
Snippets Groups Projects
Commit 9cb94c0d authored by Pierre LALET's avatar Pierre LALET
Browse files

Return Raw() when an exception occurs in .dispatch_hook()

... if not conf.debug_dissector

Idea from @paaguti in pull request #10.
parent 099b14c9
No related branches found
No related tags found
No related merge requests found
...@@ -210,7 +210,12 @@ class Packet_metaclass(type): ...@@ -210,7 +210,12 @@ class Packet_metaclass(type):
def __call__(cls, *args, **kargs): def __call__(cls, *args, **kargs):
if "dispatch_hook" in cls.__dict__: if "dispatch_hook" in cls.__dict__:
cls = cls.dispatch_hook(*args, **kargs) try:
cls = cls.dispatch_hook(*args, **kargs)
except:
if conf.debug_dissector:
raise
cls = Raw
i = cls.__new__(cls, cls.__name__, cls.__bases__, cls.__dict__) i = cls.__new__(cls, cls.__name__, cls.__bases__, cls.__dict__)
i.__init__(*args, **kargs) i.__init__(*args, **kargs)
return i return i
......
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