aboutsummaryrefslogtreecommitdiffstats
path: root/pySim-shell.py
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2023-10-09 13:32:49 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2023-10-10 11:51:08 +0200
commit6bfa8a853335e5bd75fb1f40b3ad3df95583f316 (patch)
treede5caaa14c3dc98ba7e628d2533938736109f3b1 /pySim-shell.py
parent8e03f2f2ed83497bc06443b6bd065547bd2f8209 (diff)
pySim-shell: print device info in case an exception occurs
When an exception occurs while initializing or handling the card we print a traceback, but we do not print any info that allows us to identify the device that was involved when the exception occurred. Let's include the device path or number in the error message before we print the traceback. In order to make it easier to print the device information, let's add a __str__() method to all of our devices. This method shall return the device number or path. Related: OS#6210 Change-Id: I200463e692245da40ea6d5b609bfc0ca02d15bdb
Diffstat (limited to 'pySim-shell.py')
-rwxr-xr-xpySim-shell.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pySim-shell.py b/pySim-shell.py
index 79b4d8b..56655ba 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -374,7 +374,7 @@ class PysimApp(Cmd2Compat):
rc = self.equip(card, rs)
except:
self.poutput("")
- self.poutput("Card initialization failed with an exception:")
+ self.poutput("Card initialization (%s) failed with an exception:" % str(self.sl))
self.poutput("---------------------8<---------------------")
traceback.print_exc()
self.poutput("---------------------8<---------------------")
@@ -489,7 +489,7 @@ class PysimApp(Cmd2Compat):
return
except:
self.poutput("")
- self.poutput("Card handling failed with an exception:")
+ self.poutput("Card handling (%s) failed with an exception:" % str(self.sl))
self.poutput("---------------------8<---------------------")
traceback.print_exc()
self.poutput("---------------------8<---------------------")
@@ -1031,7 +1031,7 @@ if __name__ == '__main__':
rs, card = init_card(sl)
app = PysimApp(card, rs, sl, ch, opts.script)
except:
- print("Card initialization failed with an exception:")
+ print("Card initialization (%s) failed with an exception:" % str(sl))
print("---------------------8<---------------------")
traceback.print_exc()
print("---------------------8<---------------------")