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
This commit is contained in:
Philipp Maier
2021-09-21 10:12:48 +02:00
parent af0f086497
commit 7328f10165

View File

@@ -234,5 +234,8 @@ def init_reader(opts, **kwargs) -> Optional[LinkBase]:
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