summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-08-27 20:51:40 +0200
committerVadim Yanitskiy <axilirator@gmail.com>2019-08-27 21:04:47 +0200
commit78199f4f7b4a4ef28cf9f282f89048c051e4313e (patch)
treef205a93b423c2a8ab7f1d96f099b8400fe9605c4 /src
parent6af5d8da2c3df768b9a00235d70f433be08e525b (diff)
trx_toolkit/trx_sniff.py: print exact message parsing error
For sure, the following message is much more informative: Ignoring an incorrect message: Unhandled version 12 than: Failed to parse message, dropping... NOTE: since the way of printing exceptions is different in both Python versions, I had to drop Python 2 support. Change-Id: I5fb02ce508c58ff94e47accc0ed655939eb53062
Diffstat (limited to 'src')
-rwxr-xr-xsrc/target/trx_toolkit/trx_sniff.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/target/trx_toolkit/trx_sniff.py b/src/target/trx_toolkit/trx_sniff.py
index 0323e857..72976f7e 100755
--- a/src/target/trx_toolkit/trx_sniff.py
+++ b/src/target/trx_toolkit/trx_sniff.py
@@ -1,10 +1,10 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# TRX Toolkit
# Scapy-based TRX interface sniffer
#
-# (C) 2018 by Vadim Yanitskiy <axilirator@gmail.com>
+# (C) 2018-2019 by Vadim Yanitskiy <axilirator@gmail.com>
#
# All Rights Reserved
#
@@ -22,7 +22,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-APP_CR_HOLDERS = [("2018", "Vadim Yanitskiy <axilirator@gmail.com>")]
+APP_CR_HOLDERS = [("2018-2019", "Vadim Yanitskiy <axilirator@gmail.com>")]
import logging as log
import argparse
@@ -109,8 +109,8 @@ class Application(ApplicationBase):
# Attempt to parse the payload as a DATA message
try:
msg.parse_msg(msg_raw)
- except:
- log.warning("Failed to parse message, dropping...")
+ except ValueError as e:
+ log.warning("Ignoring an incorrect message: %s" % e)
self.cnt_burst_dropped_num += 1
return