diff --git a/src/buskill_gui.py b/src/buskill_gui.py index a3349bac..4dfd75dd 100755 --- a/src/buskill_gui.py +++ b/src/buskill_gui.py @@ -172,9 +172,11 @@ def toggle_buskill(self): # buskill failed to arm/disarm; tell the user msg = "Unable to toggle buskill state" - # TODO: why is 'e' not defined? - #msg += "\n\n" +str(e) - msg += "\n\nException: " +str(self.bk.usb_handler.exception[0]) + # for some reason 'e' is undefined, but we can get the exception thrown + # by the child process from its 'exception' instance field + if self.bk.usb_handler.exception[0]: + msg += "\n\nException: " +str(self.bk.usb_handler.exception[0]) + print( msg ) self.dialog = DialogConfirmation( title = '[font=mdicons][size=30]\ue002[/size][/font] Error', diff --git a/src/packages/buskill/__init__.py b/src/packages/buskill/__init__.py index b0df9e20..71c3e566 100644 --- a/src/packages/buskill/__init__.py +++ b/src/packages/buskill/__init__.py @@ -1007,34 +1007,21 @@ def toggle(self): # launch an asynchronous child process that'll loop and listen for # usb events - msg = "DEBUG: 0"; print( msg ); logger.error( msg ) # TODO: remove me self.usb_handler = self.Process( target = self.ARM_FUNCTION ) - msg = "DEBUG: 1"; print( msg ); logger.error( msg ) # TODO: remove me self.usb_handler.start() - msg = "DEBUG: 2"; print( msg ); logger.error( msg ) # TODO: remove me # did we arm successfully? start = time.time() - msg = "DEBUG: 3"; print( msg ); logger.error( msg ) # TODO: remove me while True: # don't update the UI until the child process either sends us a # 'ping' or throws an exception - msg = "DEBUG: 4"; print( msg ); logger.error( msg ) # TODO: remove me self.check_usb_handler(0) - msg = "DEBUG: 5"; print( msg ); logger.error( msg ) # TODO: remove me - - # TODO: remove prints - msg = "usb_handler._exception:|" +str(self.usb_handler._exception)+ "|"; print(msg); logger.debug(msg) - msg = "usb_handler.exception:|" +str(self.usb_handler.exception)+ "|"; print(msg); logger.debug(msg) - msg = "DEBUG: 6"; print( msg ); logger.error( msg ) # TODO: remove me - msg = "usb_handler.status:|" +str(self.usb_handler.status)+ "|"; print(msg); logger.debug(msg) - msg = "DEBUG: 7"; print( msg ); logger.error( msg ) # TODO: remove me # did the child process throw an exception? - if self.usb_handler._exception: + if self.usb_handler.exception: # the child process threw an exception; raise it now msg = "ERROR: child process throw exception:" +str(e) @@ -1151,9 +1138,6 @@ def simulate_hotplug_removal( self ): # this works for both linux and mac def armNix( self ): - # TODO remove me (exception catching testing) - #raise Exception( 'this is a test exception' ) - # are we just simulating this USB removal? if self.SIMULATE_HOTPLUG_REMOVAL: # we're simulating a removal event