forked from M-Labs/artiq
comm_mgmt: expect error on config_read
This commit is contained in:
parent
d24a36a02a
commit
cf8e583847
|
@ -160,7 +160,12 @@ class CommMgmt:
|
||||||
def config_read(self, key):
|
def config_read(self, key):
|
||||||
self._write_header(Request.ConfigRead)
|
self._write_header(Request.ConfigRead)
|
||||||
self._write_string(key)
|
self._write_string(key)
|
||||||
self._read_expect(Reply.ConfigData)
|
ty = self._read_header()
|
||||||
|
if ty == Reply.Error:
|
||||||
|
raise IOError("Device failed to read config. The key may not exist.")
|
||||||
|
elif ty != Reply.ConfigData:
|
||||||
|
raise IOError("Incorrect reply from device: {} (expected {})".
|
||||||
|
format(ty, Reply.ConfigData))
|
||||||
return self._read_string()
|
return self._read_string()
|
||||||
|
|
||||||
def config_write(self, key, value):
|
def config_write(self, key, value):
|
||||||
|
|
Loading…
Reference in New Issue