Change in ...osmocom-bb[master]: trx_toolkit/trx_sniff.py: print exact message parsing error

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Tue Aug 27 21:05:40 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/15297


Change subject: trx_toolkit/trx_sniff.py: print exact message parsing error
......................................................................

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
---
M src/target/trx_toolkit/trx_sniff.py
1 file changed, 5 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/97/15297/1

diff --git a/src/target/trx_toolkit/trx_sniff.py b/src/target/trx_toolkit/trx_sniff.py
index 0323e85..72976f7 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 at gmail.com>
+# (C) 2018-2019 by Vadim Yanitskiy <axilirator at 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 at gmail.com>")]
+APP_CR_HOLDERS = [("2018-2019", "Vadim Yanitskiy <axilirator at gmail.com>")]
 
 import logging as log
 import argparse
@@ -109,8 +109,8 @@
 		# 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
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/15297
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I5fb02ce508c58ff94e47accc0ed655939eb53062
Gerrit-Change-Number: 15297
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190827/1ac970ae/attachment.htm>


More information about the gerrit-log mailing list