Skip to content

Commit

Permalink
attempt to fix exception catching
Browse files Browse the repository at this point in the history
  • Loading branch information
maltfield committed Jul 27, 2024
1 parent 5b0299b commit 748325b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/buskill_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ def toggle_buskill(self):
# buskill failed to arm/disarm; tell the user

msg = "Unable to toggle buskill state"
msg += "\n\n" +str(e)
# TODO: why is 'e' not defined?
#msg += "\n\n" +str(e)
msg += "\n\nException: " +str(self.bk.usb_handler.exception[0])
print( msg )
self.dialog = DialogConfirmation(
title = '[font=mdicons][size=30]\ue002[/size][/font] Error',
Expand Down
8 changes: 5 additions & 3 deletions src/packages/buskill/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,8 +1125,7 @@ def check_usb_handler( self, dt ):
self.usb_handler.status += 1

if queue_message == 'exception':
# the child just wants to let us know that it's alive; increment
# the status instance field for the child process
# the child through an exception; mark it
self.usb_handler.exception = True

else:
Expand All @@ -1152,6 +1151,9 @@ 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
Expand Down Expand Up @@ -1710,7 +1712,7 @@ def run(self):
print( msg ); logger.debug( msg )

self._cconn.send((e, tb))
self.usb_handler_queue.put( 'exception' )
raise e

@property
def exception(self):
Expand Down

0 comments on commit 748325b

Please sign in to comment.