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

dexter gerrit-no-reply at lists.osmocom.org
Wed Sep 22 14:23:53 UTC 2021


dexter has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/38/25538/1

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-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210922/d8d1849a/attachment.htm>


More information about the gerrit-log mailing list