Change in osmocom-bb[master]: trx_toolkit/data_if.py: fix: handle encoding exceptions

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
Sun Jul 26 19:59:56 UTC 2020


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


Change subject: trx_toolkit/data_if.py: fix: handle encoding exceptions
......................................................................

trx_toolkit/data_if.py: fix: handle encoding exceptions

Change-Id: I78163d41be3a912da1dd8c0543b1c3af3a0649fa
Related: OS#4681
---
M src/target/trx_toolkit/data_if.py
1 file changed, 8 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/01/19401/1

diff --git a/src/target/trx_toolkit/data_if.py b/src/target/trx_toolkit/data_if.py
index b1b1ecb..cab25aa 100644
--- a/src/target/trx_toolkit/data_if.py
+++ b/src/target/trx_toolkit/data_if.py
@@ -105,8 +105,14 @@
 		return msg
 
 	def send_msg(self, msg, legacy = False):
-		# Validate and encode TRXD message
-		payload = msg.gen_msg(legacy)
+		try:
+			# Validate and encode TRXD message
+			payload = msg.gen_msg(legacy)
+		except ValueError as e:
+			log.error("Failed to encode a TRX2L1 message ('%s') "
+				"due to error: %s" % (msg.desc_hdr(), e))
+			# TODO: we may want to send a NOPE.ind here
+			return
 
 		# Send message
 		self.send(payload)

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I78163d41be3a912da1dd8c0543b1c3af3a0649fa
Gerrit-Change-Number: 19401
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200726/5ac969a2/attachment.htm>


More information about the gerrit-log mailing list