From 8cbac2ac88c155c3ef3547b8a2be69a6a3a04f11 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sat, 17 Oct 2020 12:42:26 +0200 Subject: cosmetics, exception verbosity Signed-off-by: Toni Uhlig --- contrib/nDPIsrvd.py | 10 +++++++++- examples/py-flow-info/flow-info.py | 5 ++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/contrib/nDPIsrvd.py b/contrib/nDPIsrvd.py index 7586e4a0e..6bcaf516c 100644 --- a/contrib/nDPIsrvd.py +++ b/contrib/nDPIsrvd.py @@ -175,7 +175,15 @@ class nDPIdEvent: def validateEvent(self, event_id, event_name, list_of_event_tuples): if self.isValid is True: - raise RuntimeError('nDPId event already validated. Multiple Events in one JSON strings are not allowed.') + raise RuntimeError('nDPId event already validated. Multiple Events in one JSON strings are not allowed.\n' \ + '[EVENTS]\n' + 'current: {}\n' \ + 'daemon.: {}\n' \ + 'basic..: {}\n' \ + 'packet.: {}\n' \ + 'flow...: {}\n'.format(event_name, + self.DaemonEventName, self.BasicEventName, \ + self.PacketEventName, self.FlowEventName)) if type(event_id) is not int: raise RuntimeError('Argument is not an Integer/EventID!') diff --git a/examples/py-flow-info/flow-info.py b/examples/py-flow-info/flow-info.py index 85ada4847..f58bb1db9 100755 --- a/examples/py-flow-info/flow-info.py +++ b/examples/py-flow-info/flow-info.py @@ -15,9 +15,8 @@ def parse_json_str(json_str): if nDPIdEvent.isValid is False: raise RuntimeError('Missing event id or event name invalid in the JSON string: {}'.format(j)) if nDPIdEvent.BasicEventID != -1: - be = '{}: {}'.format(TermColor.WARNING + TermColor.BLINK + 'BASIC-EVENT' + TermColor.END, - nDPIdEvent.BasicEventPrettyName) - print('{:>18}'.format(be)) + print('{:>21}: {}'.format(TermColor.WARNING + TermColor.BLINK + 'BASIC-EVENT' + TermColor.END, + nDPIdEvent.BasicEventPrettyName)) return elif nDPIdEvent.FlowEventID == -1: return -- cgit v1.2.3