auto-t: handle exceptions correctly for start_ap

The start_ap method was raising potential dbus errors before converting
them to an IWD error type. This is due to dbus.Set() not taking an error
handler. The only way to address this is to catch the error, convert it
and raise the converted error.
This commit is contained in:
James Prestwood 2019-05-13 14:29:27 -07:00 committed by Denis Kenzior
parent d6eade2252
commit f30c4bf578
1 changed files with 5 additions and 1 deletions

View File

@ -425,7 +425,11 @@ class Device(IWDDBusAbstract):
self._wait_for_async_op()
def start_ap(self, ssid, psk):
self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'ap')
try:
self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'ap')
except Exception as e:
raise _convert_dbus_ex(e)
self._ap_iface = dbus.Interface(self._bus.get_object(IWD_SERVICE,
self.device_path),
IWD_AP_INTERFACE)