Change in pysim[master]: transport/init: print exception type if the execption has no string

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/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Sep 23 12:55:15 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/25538 )

Change subject: transport/init: print exception type if the execption has no string
......................................................................

transport/init: print exception type if the execption has no string

There may be corner cases where an execption contains no error message.
In this case it might still be helpful to display the type of the
exeption calss to get at least an idea of what kind of error we are
dealing with.

Change-Id: I6e6b3acd17e40934050b9b088960a2f851120b26
---
M pySim/transport/__init__.py
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/pySim/transport/__init__.py b/pySim/transport/__init__.py
index dae2a78..72a80a9 100644
--- a/pySim/transport/__init__.py
+++ b/pySim/transport/__init__.py
@@ -234,5 +234,8 @@
 			sl = SerialSimLink(device=opts.device, baudrate=opts.baudrate, **kwargs)
 		return sl
 	except Exception as e:
-		print("Card reader initialization failed with exception:\n" + str(e))
+		if str(e):
+			print("Card reader initialization failed with exception:\n" + str(e))
+		else:
+			print("Card reader initialization failed with an exception of type:\n" + str(type(e)))
 		return None

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I6e6b3acd17e40934050b9b088960a2f851120b26
Gerrit-Change-Number: 25538
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210923/8b6e066b/attachment.htm>


More information about the gerrit-log mailing list