Skip to content

Commit

Permalink
Catch exception when loading services
Browse files Browse the repository at this point in the history
Adding a service may fail e.g. due to the corresponding dbus interface not being available when querying the state. Previously that led to all (following) services not being available in the menu. We now catch and print an exception and go on adding more services, so that only the failing items themselves will be missing.
  • Loading branch information
cschramm committed May 15, 2015
1 parent fe0ef56 commit f15cefb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions blueman/plugins/manager/Services.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from blueman.bluez.Network import Network
from blueman.plugins.ManagerPlugin import ManagerPlugin
from gi.repository import Gtk

from blueman.Functions import create_menuitem, get_icon, composite_icon
import traceback
from blueman.Functions import create_menuitem, get_icon, composite_icon, dprint
from blueman.main.AppletService import AppletService
from blueman.services import *

Expand Down Expand Up @@ -56,7 +56,12 @@ def add_menu_item(manager_menu, service):
if isinstance(service, Input):
manager_menu.Signals.Handle("bluez", device, manager_menu.service_property_changed, "PropertyChanged")

add_menu_item(manager_menu, service)
try:
add_menu_item(manager_menu, service)
except Exception as e:
dprint("Failed to load service %s" % service.name)
traceback.print_exc()
continue

if service.group == 'serial':
for dev in rfcomm_list():
Expand Down

0 comments on commit f15cefb

Please sign in to comment.