diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-05-13 22:51:07 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-05-13 22:51:07 -0700 |
commit | 77f4d70814be6ff804aacffb8968c9f5543fd7e5 (patch) | |
tree | 6577def26c01533d99cf68875967c8fd48479aa2 /test | |
parent | bf64492865a5387200edf25628cab1e0c7ec1a75 (diff) | |
download | connman-77f4d70814be6ff804aacffb8968c9f5543fd7e5.tar.gz connman-77f4d70814be6ff804aacffb8968c9f5543fd7e5.tar.bz2 connman-77f4d70814be6ff804aacffb8968c9f5543fd7e5.zip |
Add exception handling to some service method calls
Diffstat (limited to 'test')
-rwxr-xr-x | test/test-connman | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/test/test-connman b/test/test-connman index ae8cb305..81dca916 100755 --- a/test/test-connman +++ b/test/test-connman @@ -214,7 +214,10 @@ elif sys.argv[1] in ["connect", "conn"]: service = dbus.Interface(bus.get_object("org.moblin.connman", path), "org.moblin.connman.Service") - service.Connect(timeout=60000) + try: + service.Connect(timeout=60000) + except dbus.DBusException, error: + print "%s: %s" % (error._dbus_error_name, error.message) elif sys.argv[1] in ["disconnect", "disc"]: if (len(sys.argv) < 3): @@ -226,7 +229,10 @@ elif sys.argv[1] in ["disconnect", "disc"]: service = dbus.Interface(bus.get_object("org.moblin.connman", path), "org.moblin.connman.Service") - service.Disconnect() + try: + service.Disconnect() + except dbus.DBusException, error: + print "%s: %s" % (error._dbus_error_name, error.message) elif sys.argv[1] in ["remove"]: if (len(sys.argv) < 3): @@ -244,7 +250,10 @@ elif sys.argv[1] in ["remove"]: print "Only favorite services can be removed" sys.exit(1) - service.Remove() + try: + service.Remove() + except dbus.DBusException, error: + print "%s: %s" % (error._dbus_error_name, error.message) elif sys.argv[1] == "scan": properties = manager.GetProperties() |