aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-02-15 13:41:17 +0100
committerGuido Günther <agx@sigxcpu.org>2014-02-15 13:48:20 +0100
commit9cf173763b4d21178276f228feceb799b0ce12c6 (patch)
treeec129e4376c34eb3a13f113dbf6a1e98f7c44aba
parentcd54f18e6862dc38692ad857006dbc5494f94776 (diff)
Catch error to list modems
-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)