kete: ignore errors during exit

Errors that occur during shutdown because one of the things hasn't been set up
in the expected way do not matter. For the shell we still require a manual
user exit though.

  File "./tools/tuhi-kete.py", line 344, in stop
    self.manager.disconnect(self.s1)
AttributeError: 'Searcher' object has no attribute 's1'

  File "./tools/tuhi-kete.py", line 267, in _on_name_vanished
    self.mainloop.quit()
AttributeError: 'NoneType' object has no attribute 'quit'
pull/36/head
Peter Hutterer 2018-01-29 09:26:08 +10:00
parent 8b50a7c2da
commit 7d86305b52
1 changed files with 10 additions and 3 deletions

View File

@ -264,7 +264,10 @@ class TuhiKeteManager(_DBusObject):
def _on_name_vanished(self, connection, name):
logger.error('Tuhi daemon went away')
self.mainloop.quit()
try:
self.mainloop.quit()
except AttributeError:
pass
def __getitem__(self, btaddr):
return self._devices[btaddr]
@ -341,8 +344,12 @@ class Searcher(Worker):
if self.manager.searching:
logger.debug('Stopping search')
self.manager.stop_search()
self.manager.disconnect(self.s1)
self.manager.disconnect(self.s2)
try:
self.manager.disconnect(self.s1)
self.manager.disconnect(self.s2)
except AttributeError:
pass
def _on_notify_search(self, manager, pspec):
if not manager.searching: