aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ppm/modemproxy.py5
-rwxr-xr-xsrc/prepaid-manager-applet.py6
2 files changed, 9 insertions, 2 deletions
diff --git a/src/ppm/modemproxy.py b/src/ppm/modemproxy.py
index db791b4..ae3f650 100644
--- a/src/ppm/modemproxy.py
+++ b/src/ppm/modemproxy.py
@@ -123,7 +123,10 @@ class ModemManagerProxy(GObject.GObject):
self.MM_DBUS_OBJECT_MODEM_MANAGER,
self.MM_DBUS_INTERFACE_MODEM_MANAGER,
None)
- ret = mm.EnumerateDevices()
+ try:
+ ret = mm.EnumerateDevices()
+ except Exception as e:
+ raise ModemError("Failed to list modems: %s" % e)
for modem in ret:
modems.append(modem)
return modems
diff --git a/src/prepaid-manager-applet.py b/src/prepaid-manager-applet.py
index 29d90a9..22464e0 100755
--- a/src/prepaid-manager-applet.py
+++ b/src/prepaid-manager-applet.py
@@ -194,7 +194,11 @@ class PPMController(GObject.GObject):
self.mm = ModemManagerProxy()
self._connect_mm_signals()
- modems = self.mm.get_modems()
+ try:
+ modems = self.mm.get_modems()
+ except ModemError as e:
+ logging.error("%s" % e.msg)
+ modems = None
if modems:
modem = modems[0] # FIXME: handle multiple modems
logging.debug("Using modem %s" % modem)