cosmetics, exception verbosity

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni Uhlig
2020-10-17 12:42:26 +02:00
parent ec9dc251d2
commit 8cbac2ac88
2 changed files with 11 additions and 4 deletions

View File

@@ -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!')

View File

@@ -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